MediaRecorder: state property

The MediaRecorder.state read-only property returns the current state of the current MediaRecorder object.

Value

A string containing one of the following values:

inactive

Recording is not occurring — it has either not been started yet, or it has been started and then stopped.

recording

Recording has been started and the UA is capturing data.

paused

Recording has been started, then paused, but not yet stopped or resumed.

Examples

js

record.onclick = () => {
  mediaRecorder.start();
  console.log(mediaRecorder.state);
  // Will return "recording"
  console.log("recorder started");
};

Specifications

Specification
MediaStream Recording
# dom-mediarecorder-state

Browser compatibility

BCD tables only load in the browser

See also