Navigation Menu

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

examples: dont fiddle with srcObject if already set #1129

Merged
merged 1 commit into from Apr 27, 2017

Conversation

fippo
Copy link
Contributor

@fippo fippo commented Apr 18, 2017

dont attempt to set srcObject if it is already set in the examples.

This covers two cases:

@taylor-b
Copy link
Contributor

The early media case isn't relevant in these specific examples, since they don't set srcObject before the track event fires. But the point that it will fire twice, with an audio and video track, is valid, so LGTM.

@taylor-b
Copy link
Contributor

One issue may be that when the track event is first fired, as currently specified the stream will only include one track (the one in the event).

So will it be an issue if srcObject is set while the stream only has an audio track, then the video track is added in the next microtask? Or is this guaranteed to work? I've run into some issues with this kind of thing in Chrome, but was unsure if it was a bug or expected behavior.

@taylor-b
Copy link
Contributor

Created #1135 for the above issue.

Can we mention in a comment somewhere why the !srcObject check is needed? Which I'd assume is to avoid invoking the media element load algorithm twice.

dont attempt to set srcObject if it is already set in
the examples.

This covers two cases:
* ontrack with an audio and a video track
* early media (see discussion in w3c#1128)
@fippo
Copy link
Contributor Author

fippo commented Apr 21, 2017

added a comment "don't set srcObject again if it is already set." to the samples. Which made me wonder if the check should be more specific and only avoid setting the same stream again but the example would blow up with multiple streams anyway.

We don't seem to have a description of what the consuming code is supposed to do with the track and stream from ontrack anywhere.

@stefhak
Copy link
Contributor

stefhak commented Apr 21, 2017

Comment to #1129 (comment): the intention is that once the MediaStream is attached to a video element (via srcObject), tracks can come and go and things should work. E.g. if a new audio track is added, the existing video and audio should continue to play with the new audio track being mixed in.

@aboba aboba merged commit aea6abc into w3c:master Apr 27, 2017
@fippo fippo deleted the fiddle-again branch April 27, 2017 16:13
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

4 participants