state
只读特性在
BaseAudioContext
interface returns the current state of the
AudioContext
.
baseAudioContext.state;
A
DOMString
. Possible values are:
suspended
: The audio context has been suspended (with the
AudioContext.suspend()
method.)
running
: The audio context is running normally.
closed
: The audio context has been closed (with the
AudioContext.close()
method.)
The following snippet is taken from our
AudioContext states demo
(
see it running live
.) The
AudioContext.onstatechange
hander is used to log the current state to the console every time it changes.
audioCtx.onstatechange = function() {
console.log(audioCtx.state);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 音频 API
The definition of 'state' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
state
|
Chrome 43 | Edge ≤79 |
Firefox
53
|
IE 不支持 No | Opera Yes |
Safari
9
Prefixed
|
WebView Android Yes | Chrome Android Yes |
Firefox Android
53
|
Opera Android Yes |
Safari iOS
9
Prefixed
|
Samsung Internet Android Yes |
完整支持
不支持
见实现注意事项。
要求使用供应商前缀或不同名称。
BaseAudioContext
createAnalyser()
createBiquadFilter()
createBuffer()
createBufferSource()
createChannelMerger()
createChannelSplitter()
createConstantSource()
createConvolver()
createDelay()
createDynamicsCompressor()
createGain()
createIIRFilter()
createOscillator()
createPanner()
createPeriodicWave()
createScriptProcessor()
createStereoPanner()
createWaveShaper()
decodeAudioData()
AnalyserNode
AudioBuffer
AudioBufferSourceNode
AudioContext
AudioContextOptions
AudioDestinationNode
AudioListener
AudioNode
AudioNodeOptions
AudioParam
AudioProcessingEvent
AudioScheduledSourceNode
AudioWorklet
AudioWorkletGlobalScope
AudioWorkletNode
AudioWorkletProcessor
BiquadFilterNode
ChannelMergerNode
ChannelSplitterNode
ConstantSourceNode
ConvolverNode
DelayNode
DynamicsCompressorNode
GainNode
IIRFilterNode
MediaElementAudioSourceNode
MediaStreamAudioDestinationNode
MediaStreamAudioSourceNode
OfflineAudioCompletionEvent
OfflineAudioContext
OscillatorNode
PannerNode
PeriodicWave
StereoPannerNode
WaveShaperNode