The removeSourceBuffer() method of the MediaSource interface removes the given SourceBuffer from the SourceBufferList associated with this MediaSource object.
The removeSourceBuffer() method of the MediaSource interface removes the given SourceBuffer from the SourceBufferList associated with this MediaSource object.
js
removeSourceBuffer(sourceBuffer)
sourceBufferThe SourceBuffer object to be removed.
None (undefined).
NotFoundError DOMException
Thrown if the supplied sourceBuffer doesn't exist in MediaSource.sourceBuffers.
js
for (let i = 0; i < 10; i++) { const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec); } mediaSource.removeSourceBuffer(mediaSource.sourceBuffers[0]);
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
removeSourceBuffer |
23 | 12 | 42 | 11Only works on Windows 8+. |
15 | 8 | 4.4.3 | 25 | 41 | 14 | 13Exposed in Mobile Safari on iPad but not on iPhone. |
1.5 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/removeSourceBuffer