Limited availability
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 SourceBuffer
s appended to a particular MediaSource
can be retrieved using the MediaSource.sourceBuffers
property.
The individual source buffers can be accessed using the bracket notation []
.
SourceBufferList.length
Read only
Returns the number of SourceBuffer
objects in the list.
Inherits methods from its parent interface, EventTarget
.
addsourcebuffer
Fired when a SourceBuffer
is added to the list.
removesourcebuffer
Fired when a SourceBuffer
is removed from the list.
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 Browser compatibility See also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4