element-call
element-call copied to clipboard
Joining a room call in embedded mode sometimes fails within Element Web
When running Element Call embedded within Element Web using the "New group call experience" labs feature I sometimes see a behaviour where I attempt to start a room call and after pressing "Join call" I get returned to the timeline rather than actually entering the call.
In the console you see The widget died; treating this as a user hangup logged
@toger5 had spotted this previously and sent messages in #matrix-dev about it. The message describing when this was observed matches my own observations:
The reason I am looking into this is that Calls sometimes just stop when clicking the join button in the lobby. I noticed that this makes sense since the condition for them to stop is that the state changes to no memberships memberships=[].
Here is how it looks from a UX point of view:
https://github.com/element-hq/element-call/assets/6955675/30d6fa12-9838-4ca3-af40-5a8178dd4dbb
When looking at it I also came to the conclusion that the sequence of room rate events being (re-)emitted and (re-)processed by https://github.com/matrix-org/matrix-js-sdk/blob/d90292bff5ed026fba72b1ffa8b5284b1fb76577/src/matrixrtc/MatrixRTCSessionManager.ts#L133-L148 that causes an issue.
How I originally came on to this issue was that I was looking at https://github.com/element-hq/element-call/issues/2415 and found that the key distribution failed after encountering this behaviour. I will add some context on that issue shortly too.
Possibly related issues:
- https://github.com/matrix-org/matrix-js-sdk/issues/4198 - identifies that room state is inconsistent depending on which part of the
js-sdk
data model you use. - https://github.com/matrix-org/matrix-js-sdk/pull/4242 - this is an attempt to prevent reemissions when old state is reprocessed, but I'm not sure it gets to the root of the problem
Thoughts:
- is it expected and "correct" that js-sdk would be emitting these state events twice?
- if not, then what is the root cause of the reemissions?
- if it is expected that room state events might be emitted twice and out of order then the current approach in
MatrixRTCSessionManager
is not suitable