SourceBuffer.remove()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

SourceBuffer 接口的 remove() 方法从 SourceBuffer 中移除指定时间范围的媒体片段。该方法仅能在 SourceBuffer.updatingfalse 时调用。如果 SourceBuffer.updating 不等于 false,请调用 SourceBuffer.abort()

语法

js
remove(start, end)

参数

start

表示时间范围开始的双精度浮点数,以秒为单位。

end

表示时间范围结束的双精度浮点数,以秒为单位。

返回值

无(undefined)。

异常

InvalidAccessError DOMException

如果 MediaSource.duration 属性为 NaNstart 参数是负数或者大于 MediaSource.duration,或者 end 参数小于或等于 start 或等于 NaN,则抛出异常。

InvalidStateError DOMException

如果 SourceBuffer.updating 属性等于 true,或者这个 SourceBuffer 已经从 MediaSource 移除,则抛出异常。

示例

待定

规范

Specification
Media Source Extensions™
# dom-sourcebuffer-remove

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
remove
Available in workers
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.

参见