Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exceptions where HTMLMediaElement loads and plays race #185

Merged
merged 5 commits into from Aug 31, 2016

Conversation

ara4n
Copy link
Member

@ara4n ara4n commented Aug 31, 2016

No description provided.

@ara4n ara4n changed the title Matthew/webrtc promises Fix exceptions where HTMLMediaElement loads and plays race Aug 31, 2016
* Lookup from opaque queue ID to a promise for media element operations that
* need to be serialised into a given queue
*/
MatrixCall.mediaPromises = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you attaching this to the prototype rather than being an instance member of the MatrixCall like the other fields are?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we're using this as a dictionary where an external entity (the caller) can set arbitrary keys. We should make this a proper map then using Object.create(null) (an object without a prototype) else you can get fun bugs if people decide to use "hasOwnProperty" as a queue ID. It's unlikely to happen in this particular case, but given it's a direct replacement and everything else remains the same, it's trivial to do.

@kegsay
Copy link
Member

kegsay commented Aug 31, 2016

LGTM aside from comments.

@kegsay
Copy link
Member

kegsay commented Aug 31, 2016

LGTM

@ara4n
Copy link
Member Author

ara4n commented Aug 31, 2016

ironically there was a horrific bug here; by discarding failed promises, the whole promise chain will break forever if a play() fails. Turns out this is quite common, as things like unmounting the <video/> tag whilst its play() is waiting for media to arrive causes the play()'s promise to fail. This is easy to do when toggling between rooms whilst waiting for calls to start, etc.

Hopefully this is fixed now and so going to merge (with a bunch of debugging in case of future problems)

@ara4n ara4n merged commit 41af7c8 into develop Aug 31, 2016
@t3chguy t3chguy deleted the matthew/webrtc-promises branch May 10, 2022 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants