MediaRecorder.state
The MediaRecorder.state
read-only property returns the current state of the current MediaRecorder
object.
Syntax
var state = MediaRecorder.state
Values
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.
Example
... record.onclick = function() { mediaRecorder.start(); console.log(mediaRecorder.state); // Will return "recording" console.log("recorder started"); } ...
Specifications
Specification |
---|
MediaStream Recording # dom-mediarecorder-state |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
state |
49
47-49
Before Chrome 49, only video is supported, not audio.
|
79 |
25 |
No |
36 |
14 |
49
47-49
Before Chrome 49, only video is supported, not audio.
|
49
47-49
Before Chrome 49, only video is supported, not audio.
|
25 |
36 |
14 |
5.0 |
See also
- Using the MediaRecorder API
- Web Dictaphone: MediaRecorder + getUserMedia + Web Audio API visualization demo, by Chris Mills (source on Github.)
- simpl.info MediaStream Recording demo, by Sam Dutton.
Navigator.getUserMedia
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/state