MediaRecorder: state property
MediaStream Recording
MediaStream Recording
The **`state`** read-only property of the MediaRecorder interface 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 user agent 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
## Browser compatibility
## See also
- [Using the MediaStream Recording API](/docs/Web/API/MediaStream_Recording_API/Using_the_MediaStream_Recording_API)
- [Web Dictaphone](https://mdn.github.io/dom-examples/media/web-dictaphone/): MediaRecorder +
getUserMedia + Web Audio API visualization demo, by [Chris Mills](https://github.com/chrisdavidmills) ([source on GitHub](https://github.com/mdn/dom-examples/tree/main/media/web-dictaphone).)
- [simpl.info MediaStream Recording demo](https://simpl.info/mediarecorder/), by [Sam Dutton](https://github.com/samdutton).
- Navigator.getUserMedia()
Cite this
"MediaRecorder: state property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/state JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy