OfflineAudioContext: complete event

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.

complete当离线音频上下文的呈现完成时,将触发OfflineAudioContext接口的事件。

泡泡 没有
取消 没有
默认操作 没有
接口 OfflineAudioCompletionEvent
事件处理程序属性 OfflineAudioContext.oncomplete

例子

处理完成后,你可能希望使用oncomplete处理程序提示用户现在可以播放音频,并启用播放按钮:

js
offlineAudioCtx.addEventListener("complete", () => {
  console.log("Offline audio processing now complete");
  showModalDialog("Song processed and ready to play");
  playBtn.disabled = false;
});

You can also set up the event handler using the OfflineAudioContext.oncomplete property:

js
offlineAudioCtx.oncomplete = function () {
  console.log("Offline audio processing now complete");
  showModalDialog("Song processed and ready to play");
  playBtn.disabled = false;
};

Specifications

Specification
Web Audio API
# OfflineAudioCompletionEvent
Web Audio API
# dom-offlineaudiocontext-oncomplete

Browser compatibility

BCD tables only load in the browser

See also