web api instance method
MediaSource: removeSourceBuffer() method
Available in workers
The removeSourceBuffer() method of the MediaSource interface removes the given SourceBuffer from the SourceBufferList associated with this MediaSource object.
Syntax
removeSourceBuffer(sourceBuffer)
Parameters
sourceBuffer- : The
SourceBufferobject to be removed.
- : The
Return value
None (undefined).
Exceptions
NotFoundErrorDOMException- : Thrown if the supplied sourceBuffer doesn’t exist in
sourceBuffers.
- : Thrown if the supplied sourceBuffer doesn’t exist in
Examples
for (let i = 0; i < 10; i++) {
const sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);
}
mediaSource.removeSourceBuffer(mediaSource.sourceBuffers[0]);
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.