MediaRecorder: pause event

The pause event of the MediaRecorder interface is fired when MediaRecorder.pause() is called.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

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

onpause = (event) => {};

Event type

A generic Event.

Example

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
};

Specifications

Specification
MediaStream Recording
# dom-mediarecorder-onpause

Browser compatibility

BCD tables only load in the browser

See also