MediaRecorder: state property
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.
Thestate read-only property of theMediaRecorder interface returns the current state of the currentMediaRecorder object.
In this article
Value
A string containing one of the following values:
inactiveRecording is not occurring — it has either not been started yet, or it has been started and then stopped.
recordingRecording has been started and theuser agent is capturing data.
pausedRecording 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
See also
- Using the MediaStream Recording API
- Web Dictaphone: MediaRecorder +getUserMedia + Web Audio API visualization demo, byChris Mills (source on GitHub.)
- simpl.info MediaStream Recording demo, bySam Dutton.
Navigator.getUserMedia()