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.onstatechange

AudioContextonstatechange属性定义了一个事件处理器函数,触发statechange会被调用,也就是说audio context的状态发生变化时会执行。

语法

var audioCtx = new AudioContext();
audioCtx.onstatechange = function() { ... };

例子

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

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

规范

Specification Status Comment
Web Audio API
onstatechange
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,