Back to Content

SourceBuffer: updatestart event

files/en-us/web/api/sourcebuffer/updatestart_event/index.md

latest1.2 KB
Original Source

{{APIRef("Media Source Extensions")}}{{AvailableInWorkers("window_and_dedicated")}}

The updatestart event of the {{domxref("SourceBuffer")}} interface signals the beginning of an {{domxref("SourceBuffer.appendBuffer", "appendBuffer()")}} or {{domxref("SourceBuffer.remove", "remove()")}} operation. The {{domxref("SourceBuffer.updating", "updating")}} attribute transitions from false to true.

Syntax

Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.

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

onupdatestart = (event) => { }

Event type

A generic {{domxref("Event")}}.

Examples

Listening for the updatestart event

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{domxref("SourceBuffer.appendBuffer()")}}
  • {{domxref("SourceBuffer.remove()")}}