The type, kind, and number of active tracks are enough information to figure out which SourceBuffers need to be active and what data to filter out of transmuxer output before appending.
available streams | tracks kinds | source buffer mime types |
---|---|---|
video+audio | main | video/mp2t |
video+audio,audio | main,alternative | video/mp2t, application/octet-stream;codecs=mp4a |
video,audio | main,main | video/mp2t;codecs=avc1, application/octet-stream;codecs=mp4a |
video+audio,video,audio | main,alternative,alternative | video/mp2t, application/octet-stream;codecs=mp4a |
The steps and responsibilities for common MediaSource input configurations are listed below. Steps are prefixed with the party responsible for performing them:
- App: the application developer
- VJS: video.js
- HLS: videojs-contrib-hls
- MSE: videojs-contrib-mse
video+audio
- HLS: create a media source
- HLS: create a source buffer with type
video/mp2t
video+audio,audio
- HLS: create a media source
- HLS: create a source buffer with type
video/mp2t
- HLS: create a source buffer with type
application/octet-stream; codecs=mp4a.40.2
(It doesn't look like Apple has defined a mime type for packed audio with AAC, their examples use application/octet-stream or text/plain)
video,audio
- HLS: create a media source
- HLS: create a source buffer with type
video/mp2t; codecs=avc1....
- HLS: create a source buffer with type
application/octet-stream; codecs=mp4a...
- App: change an audio track with kind
alternative
toenabled
- VJS: fire a
change
event at the AudioTrackList object - MSE: determine the appropriate source buffer configuration by querying the set of enabled audio and video tracks
- MSE: disable audio input is on the primary source buffer
- MSE: enable audio input on the audio-only source buffer