-
Notifications
You must be signed in to change notification settings - Fork 57
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
Multiple attachable/detachable SourceBuffers #360
Comments
You may want to have a read of #357 which I believe cover the use case you describing in a different fashion (detach the MediaSource instead of the SourceBuffer). Detaching a SourceBuffer (and not the MediaSource) would likely be a more complex enterprise from an implementation perspective. |
Thanks I think you are right and this goes in the same direction. As you pointed out we would need to detach/attach the MediaSource instead of individual SourceBuffers. |
As far as I know this is not a spec limitation, this is a quality of implementation issue. Quoting the MSE spec: https://www.w3.org/TR/media-source-2/#activesourcebuffers-attribute
If you have multiple tracks of the same type, that is meant to be handled with the {Audio,Video,Text}TrackList APIs: https://html.spec.whatwg.org/multipage/media.html#audiotracklist-and-videotracklist-objects The track APIs allow you to have at any point any number of audio tracks and text tracks enabled, and up to one video track enabled. The MSE spec also addresses how this should be handled in MSE. Quoting the MSE spec again:
Unfortunately, if you look in Browser compatibility here https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement#browser_compatibility you'll see only WebKit ships AudioTrackList and VideoTrackList enabled without a flag. |
This issue is a follow-up on the discussion we had in the W3C Media and Entertainment IG calls. See also
Additional Information
below.Overview
MSE based media players initialize the required
SourceBuffer
objects at the beginning of a media playback session. Currently, only oneSourceBuffer
per media type (e.g.audio
,video
) can be attached and used.Description / Background / Use Cases
Server-guided ad-insertion
In the context of server-guided ad-insertion a media player is temporarily switching playback between different content/manifest files (switch from main content to an ad and back). In this case, segments of different content might not be aligned perfectly:
In the example above, segment 2 is not aligned with segment 1, both would overlap in the buffer. As a consequence, segment 1 needs to be played until the end before segment 2 can be appended to the
SourceBuffer
. In such cases, a virtual buffer can be maintained on a client, but appended segments there will not be parsed. In addition, the timing when to push from the virtual buffer to the main buffer can be tricky.Suggested Solution
Having the possibility to maintain multiple
SourceBuffers
that can be detached and switched would make it easier for a media player to cover scenarios as the one described above. See also #359 for details on dynamically adding and removingSourceBuffers
.Additional Information
For related information, please refer to the meeting minutes of the W3C Media and Entertainment IG:
The text was updated successfully, but these errors were encountered: