MediaRecorder: resume 事件

当调用 MediaRecorder.resume() 时,MediaRecorder 接口的 resume 事件会被触发。

语法

在诸如 addEventListener() 之类的函数中使用事件名称,或者设置一个事件处理程序属性。

js
addEventListener("resume", (event) => {});

onresume = (event) => {};

事件类型

一个通用的 Event

示例

js
pause.onclick = () => {
  if (MediaRecorder.state === "recording") {
    mediaRecorder.pause();
    // recording paused
  } else if (MediaRecorder.state === "paused") {
    mediaRecorder.resume();
    // resume recording
  }
};

mediaRecorder.onpause = () => {
  // do something in response to
  // recording being paused
};

mediaRecorder.onresume = () => {
  // do something in response to
  // recording being resumed
};

规范

规范
MediaStream Recording
# dom-mediarecorder-onresume

浏览器兼容性

BCD 表格仅在浏览器中加载

另请参见