MediaSource.removeSourceBuffer()
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The removeSourceBuffer() method of the
MediaSource interface removes the given SourceBuffer from
the SourceBuffers list associated with this MediaSource
object.
Syntax
mediaSource.removeSourceBuffer(sourceBuffer);
Parameters
- sourceBuffer
-
The
SourceBufferobject to be removed.
Return value
Exceptions
NotFoundErrorDOMException-
Thrown if the supplied sourceBuffer doesn't exist in
MediaSource.sourceBuffers.
Examples
for (i = 0; i < 10; i++) {
var sourceBuffer = mediaSource.addSourceBuffer(mimeCodec);
}
mediaSource.removeSourceBuffer(mediaSource.sourceBuffers[0]);
Specifications
| Specification |
|---|
| Media Source Extensions™ # dom-mediasource-removesourcebuffer |
Browser compatibility
BCD tables only load in the browser