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 inDedicated Web Workers.
TheSourceBufferList interface represents a simple container list for multipleSourceBuffer objects.
The source buffer list containing theSourceBuffers appended to a particularMediaSource can be retrieved using theMediaSource.sourceBuffers property.
The individual source buffers can be accessed using thebracket notation[].
In this article
Instance properties
SourceBufferList.lengthRead onlyReturns the number of
SourceBufferobjects in the list.
Instance methods
Inherits methods from its parent interface,EventTarget.
Events
addsourcebufferFired when a
SourceBufferis added to the list.removesourcebufferFired when a
SourceBufferis removed from the list.
Examples
This example shows how to access the active source buffers of theMediaSource connected to an already playingHTMLVideoElement.
// Video is an already playing video using a MediaSource srcObjectconst 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> |