SourceBuffer: updatestart 事件

可用性有限

此特性不是基線特性,因為它在一些最廣泛使用的瀏覽器中不起作用。

注意:此功能在 專用 Web Workers 中可用。

SourceBuffer 介面的 updatestart 事件標誌著 appendBuffer()remove() 操作的開始。此時,updating 屬性會從 false 變為 true

語法

在諸如 addEventListener() 之類的方法中使用事件名稱,或設定事件處理程式屬性。

js
addEventListener("updatestart", (event) => { })

onupdatestart = (event) => { }

事件型別

一個通用的 Event

示例

監聽 updatestart 事件

js
const sourceBuffer = source.addSourceBuffer(mimeCodec);
sourceBuffer.addEventListener("updatestart", () => {
  downloadStatus.textContent = "Modifying buffer...";
});
sourceBuffer.addEventListener("updateend", () => {
  downloadStatus.textContent = "Modification complete";
});

規範

規範
Media Source Extensions™
# dfn-updatestart
Media Source Extensions™
# dom-sourcebuffer-onupdatestart

瀏覽器相容性

另見