SourceBufferList
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: This feature is available in Dedicated Web Workers.
The SourceBufferList interface represents a simple container list for multiple SourceBuffer objects.
The source buffer list containing the SourceBuffers appended to a particular MediaSource can be retrieved using the MediaSource.sourceBuffers property.
The individual source buffers can be accessed using the bracket notation [].
Instance properties
SourceBufferList.lengthRead only-
Returns the number of
SourceBufferobjects in the list.
Instance methods
Inherits methods from its parent interface, EventTarget.
Events
addsourcebuffer-
Fired when a
SourceBufferis added to the list. removesourcebuffer-
Fired when a
SourceBufferis removed from the list.
Examples
This example shows how to access the active source buffers of the MediaSource connected to an already playing HTMLVideoElement.
// Video is an already playing video using a MediaSource srcObject
const video = document.querySelector("video");
const mediaSource = video.srcObject;
const sourceBufferList = mediaSource.activeSourceBuffers;
for (const sourceBuffer of sourceBufferList) {
// Do something with each SourceBuffer, such as call abort()
sourceBuffer.abort();
}
Specifications
| Specification |
|---|
| Media Source Extensions™ # sourcebufferlist |
Browser compatibility
| desktop | mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
SourceBufferList
|
|
|
|
|
|
|
|
|
|
|
|
|
addsourcebuffer event
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Available in workers
|
|
|
|
|
|
|
|
|
|
|
|
|
length
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Available in workers
|
|
|
|
|
|
|
|
|
|
|
|
|
removesourcebuffer event
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Available in workers
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- Requires a vendor prefix or different name for use.
- Has more compatibility info.