Firefox Tomorrow

web api instance method

MediaRecorder: pause() method

View on MDN ↗

The pause() method of the MediaRecorder interface is used to pause recording of media streams.

When a MediaRecorder object’s pause() method is called, the browser queues a task that runs the below steps:

  1. If state is “inactive”, raise a DOM InvalidState error and terminate these steps. If not, continue to the next step.
  2. Set state to “paused”.
  3. Stop gathering data into the current Blob, but keep it available so that recording can be resumed later on.
  4. Raise a pause event.

Syntax

pause()

Parameters

None.

Return value

None (undefined).

Exceptions

  • InvalidStateError DOMException
    • : Thrown if the MediaRecorder is currently "inactive"; you cannot pause the recording if the MediaRecorder is not active. If you call pause() while already paused, the method silently does nothing.

Examples

pause.onclick = () => {
  mediaRecorder.pause();
  console.log("recording paused");
};

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also