From 8073f6918d82e41e3f086deae9dff7d93e3e1815 Mon Sep 17 00:00:00 2001
From: Matt Wolenetz On top of editorial updates, substantives changes since publication as a W3C Recommendation in November 2016 are the addition of a {{SourceBuffer/changeType()}} method to switch codecs, the possibility to create and use {{MediaSource}} objects off the main thread in dedicated workers, and the removal of the On top of editorial updates, substantive changes since publication as a W3C Recommendation in November 2016 are
+ createObjectURL()
extension to the {{URL}} object following its integration in the File API [[FILEAPI]]. For a full list of changes done since the previous version, see the commits.
+
+ For a full list of changes done since the previous version, see the commits.createObjectURL()
extension to the {{URL}} object following its integration in the File API [[FILEAPI]]
The working group maintains a list of all bug reports that the editors have not yet tried to address.
Implementors should be aware that this specification is not stable. Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should track the GitHub repository and take part in the discussions.
@@ -323,15 +330,26 @@REMOVE THIS PLACEHOLDER NOTE: TODO describe SourceBufferConfig and the updated addSourceBuffer and the linkage to [[WEBCODECS]]
sourceBuffers
of type SourceBufferList, readonly activeSourceBuffers
of type SourceBufferList, readonly [Exposed=(Window,DedicatedWorker)] ++[Exposed=(Window,DedicatedWorker)] interface SourceBuffer : EventTarget { attribute AppendMode mode; readonly attribute boolean updating; @@ -1155,13 +1174,20 @@+}; + +typedef (sequence< (EncodedAudioChunk or EncodedVideoChunk) > + or EncodedAudioChunk or EncodedVideoChunk) EncodedChunks; +SourceBuffer Object
attribute EventHandler onerror; attribute EventHandler onabort; undefined appendBuffer (BufferSource data); + Promise < undefined > appendEncodedChunks(EncodedChunks chunks); undefined abort (); - undefined changeType (DOMString type); + undefined changeType (optional TypeOrConfig typeOrConfig = {}); undefined remove (double start, unrestricted double end); -};
mode
of type AppendModeREMOVE THIS PLACEHOLDER NOTE: TODO describe encodedchunks, appendEncodedChunks, and the updated changeType and linkage to [[WEBCODECS]].
+mode
of type AppendModeControls how a sequence of [=media segments=] are handled. This attribute is initially set by {{MediaSource/addSourceBuffer()}} after the object is created, and can be updated by {{SourceBuffer/changeType()}} or setting this attribute.
On getting, Return the initial value or the last value that was successfully set.
On setting, run the following steps:
From 7811830f182697016db33e0fdc2d4909ef0de57a Mon Sep 17 00:00:00 2001 From: Matt WolenetzThe [=duration change=] algorithm will adjust |new duration| higher if there is any currently buffered coded frame with a higher end time.
-{{SourceBuffer/appendBuffer()}} and {{MediaSource/endOfStream()}} can update the duration under certain circumstances.
+{{SourceBuffer/appendBuffer()}}, {{SourceBuffer/appendEncodedChunks()}} and {{MediaSource/endOfStream()}} can update the duration under certain circumstances.
onsourceopen
of type {{EventHandler}}Per [[HTML]] logic, {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} changes may trigger events on the HTMLMediaElement.
-The web application can use {{SourceBuffer/buffered}} and {{HTMLMediaElement}}.{{HTMLMediaElement/buffered}} to determine what the media element needs to resume playback.
REMOVE THIS PLACEHOLDER NOTE: TODO describe encodedchunks, appendEncodedChunks, and the updated changeType and linkage to [[WEBCODECS]].
+REMOVE THIS PLACEHOLDER NOTE: TODO describe appendEncodedChunks, the updated changeType and linkage to [[WEBCODECS]].
mode
of type AppendModeControls how a sequence of [=media segments=] are handled. This attribute is initially set by {{MediaSource/addSourceBuffer()}} after the object is created, and can be updated by {{SourceBuffer/changeType()}} or setting this attribute.
On getting, Return the initial value or the last value that was successfully set.
@@ -1211,7 +1229,7 @@updating
of type {{boolean}}, readonly Indicates whether the asynchronous continuation of an {{SourceBuffer/appendBuffer()}} or {{SourceBuffer/remove()}} +
Indicates whether the asynchronous continuation of an {{SourceBuffer/appendBuffer()}}, {{SourceBuffer/appendEncodedChunks()}} or {{SourceBuffer/remove()}} operation is still being processed. This attribute is initially set to false when the object is created.
buffered
of type {{TimeRanges}}, readonly Indicates what {{TimeRanges}} are buffered in the SourceBuffer. This @@ -1329,7 +1347,7 @@
changeType
Changes the MIME type associated with this object. Subsequent {{SourceBuffer/appendBuffer()}} calls will expect the newly appended bytes to conform to the new type. +
Changes the MIME type associated with this object (TODO: split logic by arg type, reference appendEncodedChunks() too). Subsequent {{SourceBuffer/appendBuffer()}} calls will expect the newly appended bytes to conform to the new type.
Each {{SourceBuffer}} object has a [[\buffer full flag]] internal - slot that keeps track of whether {{SourceBuffer/appendBuffer()}} is allowed to accept more bytes. It is set + slot that keeps track of whether {{SourceBuffer/appendBuffer()}} is allowed to accept more bytes or {{SourceBuffer/appendEncodedChunks()}} is allowed to accept more encoded chunks. It is set to false when the {{SourceBuffer}} object is created and gets updated as data is appended and removed.
Each {{SourceBuffer}} object has a [[\group start timestamp]] @@ -1702,7 +1720,7 @@
When {{SourceBuffer/appendBuffer()}} is called, the following steps are run to process the appended data.
+When {{SourceBuffer/appendBuffer()}} (TODO split out chunk processing) is called, the following steps are run to process the appended data.
Example use of the Media Source Extensions
-<script> ++ Buffering bytes from a bytestream format
++-++<script> function onSourceOpen(videoTag, e) { var mediaSource = e.target; @@ -2999,9 +3020,98 @@+ +Examples
mediaSource.addEventListener('sourceopen', onSourceOpen.bind(this, video)); video.src = window.URL.createObjectURL(mediaSource); </script> -
+<body> +<script> + // Very simple demuxer bound to a specific media file. + // Replace with other source of WebCodecs configs and encoded chunks. + let next_chunk_index = 0; + let buffer; + let chunk_duration = 100 * 1000; // 100 milliseconds for this example. + let metadata = [ + { + offset: /* chunk offset, e.g. 42 */, + size: /* chunk size, e.g. 4242 */, + type: /* chunk type, e.g. "key" or "delta" */ + }, // Plus additional chunks' metadata listed here. + ]; + + function getConfig() { + return( /* e.g. { videoConfig: { codec: "vp09.00.10.08" } } */ ); + } + + async function getNextEncodedChunk() { + if (next_chunk_index >= metadata.length) + return null; + if (next_chunk_index == 0) + buffer = await (await fetch(/* e.g. "vp9.chunks" */)).arrayBuffer(); + let chunk_metadata = metadata[next_chunk_index]; + let chunk_timestamp = chunk_duration * next_chunk_index; + next_chunk_index++; + // EncodedAudioChunks could also be buffered into MSE, but only one form of + // media (audio versus video) can be buffered into a specific SourceBuffer, + // so this simple example is video-only. + return new EncodedVideoChunk( { + type: chunk_metadata.type, + timestamp: chunk_timestamp, + duration: chunk_duration, + data: new Uint8Array(buffer, chunk_metadata.offset, chunk_metadata.size) + } ); + } + + // MSE player using the WebCodecs content generated, above. + async function getOpenMediaSource() { + return new Promise(async (resolve, reject) => { + const v = document.createElement("video"); + document.body.appendChild(v); + const mediaSource = new MediaSource(); + const url = URL.createObjectURL(mediaSource); + mediaSource.addEventListener("sourceopen", () => { + URL.revokeObjectURL(url); + if (mediaSource.readyState != "open") + reject(); + else + resolve([ v, mediaSource ]); + }, { once: true }); + v.src = url; + }); + } + + async function bufferMedia() { + let [ videoElement, mediaSource ] = await getOpenMediaSource(); + let sourceBuffer = mediaSource.addSourceBuffer(await getConfig()); + + // This simple player attempts to buffer everything immediately. Full + // players will condition buffering, for example, on playback progress + // and availability of chunks. + while (null != (chunk = await(getNextEncodedChunk()))) { + // Note that appending a sequence instead of a single chunk here + // could be more performant. + await sourceBuffer.appendEncodedChunks(chunk); + } + + mediaSource.endOfStream(); + videoElement.controls = true; // Show default controls. + } + + if (!SourceBuffer.prototype.hasOwnProperty("appendEncodedChunks")) + console.log("MSE-for-WebCodecs support is missing.") + else + bufferMedia(); +</script> +</body> ++
REMOVE THIS PLACEHOLDER NOTE: TODO describe SourceBufferConfig and the updated addSourceBuffer and the linkage to [[WEBCODECS]]
sourceBuffers
of type SourceBufferList, readonly activeSourceBuffers
of type SourceBufferList, readonly addSourceBuffer
addSourceBuffer
Adds a new SourceBuffer to {{MediaSource/sourceBuffers}}.
For example, a user agent MAY throw a {{QuotaExceededError}} exception if the media element has reached the {{HTMLMediaElement/HAVE_METADATA}} readyState. This can occur if the user agent's media engine does not support adding more tracks during playback.
WebCodecs encoded chunks are required to have timestamps, so there is no need to + generate them.
+REMOVE THIS PLACEHOLDER NOTE: TODO describe appendEncodedChunks, the updated changeType and linkage to [[WEBCODECS]].
+REMOVE THIS PLACEHOLDER NOTE: TODO describe appendEncodedChunks, the updated changeType and linkage to WEBCODECS.
mode
of type AppendModeControls how a sequence of [=media segments=] are handled. This attribute is initially set by {{MediaSource/addSourceBuffer()}} after the object is created, and can be updated by {{SourceBuffer/changeType()}} or setting this attribute.
On getting, Return the initial value or the last value that was successfully set.
From 73bdac1ad910706c241aee7af967de0d27e21d47 Mon Sep 17 00:00:00 2001 From: Matt WolenetzA position in a [=media segment=] where decoding and continuous playback can begin without relying on any previous data in the segment. For video this tends to be the location of I-frames. In the case of audio, most audio frames can be treated as a random access point. Since video tracks tend to have a more sparse distribution of random access points, the location of these points are usually considered the random access points for multiplexed streams.
The specific [=byte stream format specification=] that describes the format of the byte stream accepted by a SourceBuffer instance. The - [=byte stream format specification=], for a SourceBuffer object, is initially selected based on the |type:DOMString| passed to the - {{MediaSource/addSourceBuffer()}} call that created the object, and can be updated by {{SourceBuffer/changeType()}} calls on the object.
The specific [=byte stream format specification=] that describes the format of the byte stream accepted + by a {{SourceBuffer}} instance, when configured via {{MediaSource/addSourceBuffer()}} or updated by + {{SourceBuffer/changeType()}} to be based on a |typeOrConfig:TypeOrConfig| that is a DOMString. The [=byte + stream format specification=], for a {{SourceBuffer}} object, is initially selected based on the + |type:DOMString| passed to the {{MediaSource/addSourceBuffer()}} call that created the object, and can be + updated by {{SourceBuffer/changeType()}} calls on the object. When the {{SourceBuffer}} is instead using a + WebCodecs {{AudioDecoderConfig}} or {{VideoDecoderConfig}} [[WEBCODECS]] in the most recent of either the + {{MediaSource/addSourceBuffer()}} call that created the {{SourceBuffer}} or a {{SourceBuffer/changeType()}} + call, the {{SourceBuffer}} is not expecting byte stream appends via {{SourceBuffer/appendBuffer()}}; instead + it is expecting WebCodecs chunks to be appended via {{SourceBuffer/appendEncodedChunks()}}.
A specific set of tracks distributed across one or more SourceBuffer @@ -473,7 +489,9 @@
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
|type| | {{DOMString}} | ✘ | ✘ |
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
|typeOrConfig| | {{TypeOrConfig}} | ✘ | ✘ |
removeSourceBuffer
Removes a {{SourceBuffer}} from {{MediaSource/sourceBuffers}}.
@@ -483,6 +501,10 @@This method returning true implies that HTMLMediaElement.canPlayType() will return "maybe" or "probably" since it does not make sense for a MediaSource to support a type the HTMLMediaElement knows it cannot play.
++ For proactively checking support for a WebCodecs {{AudioDecoderConfig}} or {{VideoDecoderConfig}}, use the + respective {{AudioDecoder}} {{AudioDecoder/isConfigSupported()}} or {{VideoDecoder}} + {{VideoDecoder/isConfigSupported()}} method. +
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
|type| | {{DOMString}} | ✘ | ✘ |
The byte stream format specifications in the registry are not intended to define new storage formats. They simply outline the subset of existing storage format structures that implementations of this specification will accept.
Byte stream format parsing and validation is implemented in the [=segment parser loop=] algorithm.
+When currently configured by {{MediaSource/addSourceBuffer()}} or {{SourceBuffer/changeType()}} to + expect appends of WebCodecs encoded chunks via {{SourceBuffer/appendEncodedChunks()}} instead of a bytestream + via {{SourceBuffer/appendBuffer}}, the {{SourceBuffer}} does not have a specific bytestream format + associated.
This section provides general requirements for all byte stream format specifications:
REMOVE THIS PLACEHOLDER NOTE: TODO describe appendEncodedChunks, the updated changeType and linkage to WEBCODECS.
mode
of type AppendModeControls how a sequence of [=media segments=] are handled. This attribute is initially set by {{MediaSource/addSourceBuffer()}} after the object is created, and can be updated by {{SourceBuffer/changeType()}} or setting this attribute.
On getting, Return the initial value or the last value that was successfully set.
@@ -1317,7 +1332,7 @@timestampOffset
of type {{double}}Controls the offset applied to timestamps inside subsequent [=media segments=] that are appended to this SourceBuffer. The {{SourceBuffer/timestampOffset}} is initially set to 0 which indicates that no offset is being applied.
+Controls the offset applied to timestamps inside subsequent [=media segments=] TODO that are appended to this SourceBuffer. The {{SourceBuffer/timestampOffset}} is initially set to 0 which indicates that no offset is being applied.
On getting, Return the initial value or the last value that was successfully set.
On setting, run the following steps:
The event handler for the {{error}} event.
onabort
of type {{EventHandler}}The event handler for the {{abort}} event.
-appendBuffer
appendBuffer
Appends the segment data in an BufferSource[[!WEBIDL]] to the {{SourceBuffer}}.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
|data| | {{BufferSource}} | ✘ | ✘ |
abort
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
|data| | {{BufferSource}} | ✘ | ✘ |
appendEncodedChunks
Appends WebCodecs [[WEBCODECS]] {{EncodedChunks}} to the {{SourceBuffer}}.
+ +Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
|chunks| | {{EncodedChunks}} | ✘ | ✘ |
abort
Aborts the current segment and resets the segment parser.
Each {{SourceBuffer}} object has a [[\buffer full flag]] internal - slot that keeps track of whether {{SourceBuffer/appendBuffer()}} is allowed to accept more bytes or {{SourceBuffer/appendEncodedChunks()}} is allowed to accept more encoded chunks. It is set - to false when the {{SourceBuffer}} object is created and gets updated as data is appended and removed.
+ slot that keeps track of whether {{SourceBuffer/appendBuffer()}} is allowed to accept more bytes or + {{SourceBuffer/appendEncodedChunks()}} is allowed to accept more encoded chunks. It is set to false when the + {{SourceBuffer}} object is created and gets updated as data is appended and removed.Each {{SourceBuffer}} object has a [[\group start timestamp]] internal slot that keeps track of the starting timestamp for a new [=coded frame group=] in the @@ -1729,6 +1798,15 @@
This algorithm is run to free up space in this {{SourceBuffer}} when new data is appended.
+This algorithm is run to free up space in this {{SourceBuffer}} when new data is appended. New data is + either the bytes being appended via {{SourceBuffer/appendBuffer()}} or the WebCodecs {{EncodedChunks}} being + appended via {{SourceBuffer/appendEncodedChunks()}}.
Need to recognize step here that implementations MAY decide to set {{SourceBuffer/[[buffer full
flag]]}} true here if it predicts that processing |new data| in addition to any existing bytes in
From 57e512d1a06576dd4cdbf4a54ef4b8fb54400950 Mon Sep 17 00:00:00 2001
From: Matt Wolenetz A position in a [=media segment=] where decoding and continuous playback can begin without relying on any previous data in the segment. For video this tends to be the location of I-frames. In the case of audio, most audio frames can be treated as a random access point. Since video tracks tend to have a more sparse distribution of random access points, the location of these points are usually considered the random access points for multiplexed streams. The specific [=byte stream format specification=] that describes the format of the byte stream accepted
- by a {{SourceBuffer}} instance, when configured via {{MediaSource/addSourceBuffer()}} or updated by
- {{SourceBuffer/changeType()}} to be based on a |typeOrConfig:TypeOrConfig| that is a DOMString. The [=byte
- stream format specification=], for a {{SourceBuffer}} object, is initially selected based on the
- |type:DOMString| passed to the {{MediaSource/addSourceBuffer()}} call that created the object, and can be
- updated by {{SourceBuffer/changeType()}} calls on the object. When the {{SourceBuffer}} is instead using a
- WebCodecs {{AudioDecoderConfig}} or {{VideoDecoderConfig}} [[WEBCODECS]] in the most recent of either the
- {{MediaSource/addSourceBuffer()}} call that created the {{SourceBuffer}} or a {{SourceBuffer/changeType()}}
- call, the {{SourceBuffer}} is not expecting byte stream appends via {{SourceBuffer/appendBuffer()}}; instead
- it is expecting WebCodecs chunks to be appended via {{SourceBuffer/appendEncodedChunks()}}.
+ A {{SourceBuffer}} object can dynamically be configured to either expect to be sent a byte stream via
+ {{SourceBuffer/appendBuffer()}} that conforms to a specific [=byte stream format specification=], or to be
+ sent sequences of WebCodecs [[WEBCODECS]] chunks via {{SourceBuffer/appendEncodedChunks()}}.
+ When configured to expect a byte stream, the SourceBuffer byte
+ stream format specification is the specific [=byte stream format specification=] that describes the
+ format of the byte stream expected and accepted by a {{SourceBuffer}} object is initially selected based on
+ the |type:DOMString| passed to the {{MediaSource/addSourceBuffer()}} call that created the object, and can be
+ updated by {{SourceBuffer/changeType()}} calls on the object.
+ When the {{SourceBuffer}} is instead using a WebCodecs {{AudioDecoderConfig}} or {{VideoDecoderConfig}}
+ [[WEBCODECS]] in the most recent of either the {{MediaSource/addSourceBuffer()}} call that created the
+ {{SourceBuffer}} or a {{SourceBuffer/changeType()}} call, the {{SourceBuffer}} is instead expecting WebCodecs
+ chunks to be appended via {{SourceBuffer/appendEncodedChunks()}}. A specific set of tracks distributed across one or more SourceBuffer
objects owned by a single MediaSource instance. Implementations MUST support at least 1 MediaSource object with the following
@@ -451,14 +436,14 @@ For example, a user agent MAY throw a {{QuotaExceededError}} exception if the media element has reached the
{{HTMLMediaElement/HAVE_METADATA}} readyState. This can occur if the user agent's media engine does not support adding more tracks during
@@ -472,12 +457,18 @@ WebCodecs encoded chunks are required to have timestamps, so there is no need to
- generate them. The timestamps in the media segment determine where the [=coded frames=] are placed in the presentation. Media segments can be appended in any order. Media segments will be treated as adjacent in time independent of the timestamps in the media segment. Coded frames in a new media segment will be placed immediately after the coded
- frames in the previous media segment. The {{SourceBuffer/timestampOffset}} attribute will be updated if a new offset is needed to make the new media segments adjacent to the previous media segment.
- Setting the {{SourceBuffer/timestampOffset}} attribute in {{AppendMode/""sequence""}} mode allows a media segment to be placed at a specific position in the timeline without any knowledge
- of the timestamps in the media segment.
- The timestamps in the media segment or {{EncodedChunks}} determine where the [=coded frames=] are placed in
+ the presentation. Media segments can be appended in any order. Discontinuous {{EncodedChunks}} should not be
+ appended in the same {{SourceBuffer/appendEncodedChunks()}} call: the application should instead wait for the
+ {{SourceBuffer}} to no longer be {{SourceBuffer/updating}}, and then call {{SourceBuffer/abort()}} or
+ {{SourceBuffer/changeType()}} before appending {{EncodedChunks}} that are discontinuous with those in the
+ previous {{SourceBuffer/appendEncodedChunks()}} call. Media segments will be treated as adjacent in time independent of the timestamps in the media segment. Coded
+ frames in a new media segment will be placed immediately after the coded frames in the previous media segment.
+ As with {{AppendMode/""segments""}} mode, discontinuous {{EncodedChunks}} should not be appended in the same
+ {{SourceBuffer/appendEncodedChunks()}} call.
+ The {{SourceBuffer/timestampOffset}} attribute will be updated if a new offset is needed to make the new media
+ segments adjacent to the previous media segment. Setting the {{SourceBuffer/timestampOffset}} attribute in
+ {{AppendMode/""sequence""}} mode allows a media segment to be placed at a specific position in the timeline
+ without any knowledge of the timestamps in the media segment. Controls the offset applied to timestamps inside subsequent [=media segments=] TODO that are appended to this SourceBuffer. The {{SourceBuffer/timestampOffset}} is initially set to 0 which indicates that no offset is being applied. Controls the offset applied to timestamps inside subsequent [=media segments=] or {{EncodedChunks}} that are appended to this SourceBuffer. The {{SourceBuffer/timestampOffset}} is initially set to 0 which indicates that no offset is being applied. On getting, Return the initial value or the last value that was successfully set. On setting, run the following steps: Appends the segment data in an BufferSource[[!WEBIDL]] to the {{SourceBuffer}}. Appends WebCodecs [[WEBCODECS]] {{EncodedChunks}} to the {{SourceBuffer}}. Changes the MIME type associated with this object (TODO: split logic by arg type, reference appendEncodedChunks() too). Subsequent {{SourceBuffer/appendBuffer()}} calls will expect the newly appended bytes to conform to the new type.
+ Changes the [=SourceBuffer byte stream format specification or WebCodecs chunks buffering expectations=] for
+ this object. Enables switching among bytestreams, codecs, or even between bytestream parsing versus
+ buffering of WebCodecs encoded chunks in the same {{SourceBuffer}}. If the {{MediaSource/readyState}} attribute of the [=parent media source=] is in the {{ReadyState/""ended""}} state then run the following steps: A track buffer stores the [=track descriptions=] and [=coded frames=] for an individual
- track. The track buffer is updated as [=initialization segments=] and [=media segments=] are appended to the
- SourceBuffer. A track buffer stores the [=track descriptions=] and [=coded frames=] for an
+ individual track. The track buffer is updated as [=initialization segments=], [=media segments=], decoder
+ configurations and {{EncodedChunks}} are given to the {{SourceBuffer}}. Each [=track buffer=] has a last decode timestamp variable that stores
the decode timestamp of the last [=coded frame=] appended in the current [=coded frame group=]. The variable is initially
@@ -1723,6 +1774,7 @@ When the segment parser loop algorithm is invoked, run the following steps: When {{SourceBuffer/appendBuffer()}} (TODO split out chunk processing) is called, the following steps are run to process the appended data. When {{SourceBuffer/appendBuffer()}} is called, the following steps are run to process the appended data. Each {{SourceBuffer}} object has a [[\pending append chunks
+ promise]] internal slot that stores the promise necessary to communicate the completion of
+ asynchronous steps begun by a call to {{SourceBuffer/appendEncodedChunks()}}. If there is no asynchronous
+ {{SourceBuffer/appendEncodedChunks()}} operation in progress, then this slot is unset. Each {{SourceBuffer}} object has an [[\input webcodecs configs and
+ chunks]] internal slot that stores a queue of unprocessed {{EncodedChunks}} and at most one
+ {{SourceBufferConfig}}. The {{SourceBufferConfig}} is added if the initial call to
+ {{MediaSource/addSourceBuffer()}} that created this object was provided a {{SourceBufferConfig}}, or if
+ there is a more recent successful call to {{SourceBuffer/changeType()}} on this {{SourceBuffer}} that
+ provided a {{SourceBufferConfig}}. The contents of this slot are processed by the [=chunks append=]
+ algorithm to buffer the necessary decoder configuration and coded frames into the underlying [=track
+ buffer=]. When the chunks append algorithm is invoked, run the following steps to process the appended
+ {{EncodedChunks}} relative to the current {{SourceBufferConfig}}: Follow these steps when a caller needs to initiate a JavaScript visible range removal
@@ -1893,7 +2038,8 @@ The following steps are run when the [=segment parser loop=] successfully parses a complete [=initialization segment=]: The following steps are run when the [=segment parser loop=] successfully parses a complete
+ [=initialization segment=] or the [=chunks append=] algorithm handles a {{SourceBufferConfig}}: Each SourceBuffer object has a
[[\first initialization segment received flag]] internal slot that
tracks whether the first [=initialization segment=] has been appended and received by this algorithm. This
@@ -2254,10 +2400,11 @@ When complete [=coded frames=] have been parsed by the [=segment parser loop=] then the following steps are run: When complete [=coded frames=] have been parsed by the [=segment parser loop=] or emitted by the [=chunks
+ append=] algorithm, then the following steps are run: For each [=coded frame=] in the [=media segment=] run the following steps: For each [=coded frame=] run the following steps: If the {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} attribute is {{HTMLMediaElement/HAVE_FUTURE_DATA}} and the new [=coded frames=] cause {{HTMLMediaElement}}.{{HTMLMediaElement/buffered}} to have a {{TimeRanges}} that includes the current playback position and [=enough data to ensure uninterrupted playback=], then set the {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} attribute to {{HTMLMediaElement/HAVE_ENOUGH_DATA}}. Per [[HTML]] logic, {{HTMLMediaElement}}.{{HTMLMediaElement/readyState}} changes may trigger events on the HTMLMediaElement.Definitions
Attributes
Attributes
+
Attributes
-
SourceBuffer Object
enum AppendMode {
"segments",
"sequence"
-};
Enumeration description segments
- sequence
-
+ Enumeration description
+ segments
+ sequence
+
@@ -1332,7 +1333,7 @@
SourceBuffer Object
timestampOffset
of type {{double}}
@@ -1400,8 +1401,8 @@
SourceBuffer Object
-
SourceBuffer Object
-
SourceBuffer Object
by {{SourceBuffer/appendEncodedChunks()}}.SourceBuffer Object
-
SourceBuffer Object
changeType
-
+
+
@@ -1495,9 +1527,28 @@
SourceBuffer Object
+
+
+
+
SourceBuffer Object
Description
- |type|
- {{DOMString}}
+ |typeOrConfig|
+ {{TypeOrConfig}}
✘
✘
@@ -1586,9 +1637,9 @@ SourceBuffer Object
Track Buffers
- Segment Parser Loop
This flag is set by {{MediaSource/addSourceBuffer()}} when the {{SourceBuffer}} object is created and is
updated by {{SourceBuffer/changeType()}}.
+
@@ -1798,10 +1850,10 @@
Reset Parser State
Append Error
@@ -1864,8 +1926,15 @@
+
+
+
Prepare Append
Buffer Append
-
+
Buffer Append
Chunks Append
+
+
+
+
+
+
+ Range Removal
Range Removal
Initialization Segment Received
- Initialization Segment Received
Coded Frame Processing
-
Coded Frame Processing