MediaRecorder.state read-only property returns the current state of the current MediaRecorder 对象。

句法

var state = MediaRecorder.state
					

A AnimationPlayState object containing one of the following values:

Enumeration 描述
inactive Recording is not occuring — 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.

范例

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

规范

规范 状态 注释
MediaStream 录制
The definition of 'MediaRecorder.state' in that specification.
工作草案 初始定义

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
state Chrome 49
49
不支持 47 — 49
Prior to Chrome 49, only video is supported, not audio.
Edge 79 Firefox 25 IE No Opera 36 Safari No WebView Android 49
49
不支持 47 — 49
Prior to Chrome 49, only video is supported, not audio.
Chrome Android 49
49
不支持 47 — 49
Prior to Chrome 49, only video is supported, not audio.
Firefox Android 25 Opera Android 36 Safari iOS No Samsung Internet Android 5.0

图例

完整支持

完整支持

不支持

不支持

见实现注意事项。

另请参阅

元数据

  • 最后修改:
  1. MediaStream 录制 API
  2. MediaRecorder
  3. 构造函数
    1. MediaRecorder()
  4. 特性
    1. audioBitsPerSecond
    2. ignoreMutedMedia
    3. mimeType
    4. ondataavailable
    5. onerror
    6. onpause
    7. onresume
    8. onstart
    9. onstop
    10. onwarning
    11. state
    12. stream
  5. 方法
    1. isTypeSupported
    2. pause()
    3. requestData()
    4. resume()
    5. start()
    6. stop()
  6. 事件
    1. error
  7. 继承:
    1. EventTarget
  8. Related pages for MediaStream Recording
    1. BlobEvent
    2. MediaRecorderErrorEvent

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1