Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

AudioContext.state

AudioContextstate属性是只读的,返回AudioContext的当前状态。

语法

var audioCtx = new AudioContext();
var myState = audioCtx.state;

返回值

DOMString,可能的值如下:

例子

下面这段代码是AudioContext states demo (直接运行)中的,其中AudioContext.onstatechange处理器会在每次当前状态发生变化时把它输出到控制台。

audioCtx.onstatechange = function() {
  console.log(audioCtx.state);
}

规范

Specification Status Comment
Web Audio API
state
Working Draft  

浏览器兼容性

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 43.0 40.0 (40.0)  未实现 ? ?
Feature Android Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support ? ? ? ? ? ? ?

另见

文档标签和贡献者

 此页面的贡献者: ayqy
 最后编辑者: ayqy,