SourceBufferList
Draft: This page is not complete.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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 array operator []
.
Properties
-
SourceBufferList.length
Read only -
Returns the number of
SourceBuffer
objects in the list.
Event handlers
SourceBufferList.onaddsourcebuffer
-
The event handler for the
addsourcebuffer
event. SourceBufferList.onremovesourcebuffer
-
The event handler for the
removesourcebuffer
event.
Methods
Inherits methods from its parent interface, EventTarget
.
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 var video = document.querySelector('video'); var mediaSource = video.srcObject; var sourceBufferList = mediaSource.activeSourceBuffers; for (var i = 0; i < sourceBufferList.length; i++) { var sourceBuffer = sourceBufferList[i]; // Do something with each SourceBuffer, such as call abort() sourceBuffer.abort(); }
Specifications
Specification |
---|
Media Source Extensions™ # sourcebufferlist |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
SourceBufferList |
31
23-31
|
12 |
42 |
11
Only works on Windows 8+.
|
15 |
8 |
4.4.3 |
33 |
No |
14 |
13
Exposed in Mobile Safari on iPad but not on iPhone.
|
3.0 |
length |
23 |
12 |
42 |
11
Only works on Windows 8+.
|
15 |
8 |
4.4.3 |
33 |
No |
14 |
13
Exposed in Mobile Safari on iPad but not on iPhone.
|
3.0 |
onaddsourcebuffer |
53 |
17 |
42 |
11
Only works on Windows 8+.
|
40 |
8 |
53 |
53 |
No |
41 |
13
Exposed in Mobile Safari on iPad but not on iPhone.
|
6.0 |
onremovesourcebuffer |
53 |
17 |
42 |
11
Only works on Windows 8+.
|
40 |
8 |
53 |
53 |
No |
41 |
13
Exposed in Mobile Safari on iPad but not on iPhone.
|
6.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/SourceBufferList