This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: This feature is available in Dedicated Web Workers.
The removeSourceBuffer() method of the MediaSource interface removes the given SourceBuffer from the SourceBufferList associated with this MediaSource object.
removeSourceBuffer(sourceBuffer)
sourceBufferThe SourceBuffer object to be removed.
None (undefined).
NotFoundError DOMException
Thrown if the supplied sourceBuffer doesn't exist in MediaSource.sourceBuffers.
for (let i = 0; i < 10; i++) {
const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);
}
mediaSource.removeSourceBuffer(mediaSource.sourceBuffers[0]);
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
removeSourceBuffer |
23 | 12 | 42 | 15 | 8 | 25 | 41 | 14 | 13Exposed in Mobile Safari on iPad but not on iPhone. |
1.5 | 4.4.3 | No |
© 2005–2025 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