web api interface
SourceBufferList
Available in 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 sourceBuffers property.
The individual source buffers can be accessed using the bracket notation [].
Instance properties
lengthRead only- : Returns the number of
SourceBufferobjects in the list.
- : Returns the number of
Instance methods
Inherits methods from its parent interface, EventTarget.
Events
addsourcebuffer- : Fired when a
SourceBufferis added to the list.
- : Fired when a
removesourcebuffer- : Fired when a
SourceBufferis removed from the list.
- : Fired when a
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
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.