start()
method on
AudioScheduledSourceNode
schedules a sound to begin playback at the specified time. If no time is specified, then the sound begins playing immediately.
AudioScheduledSourceNode.start([when [, offset [, duration]]]);
当
可选
AudioContext
is using for its
currentTime
attribute. A value of 0 (or omitting the
当
parameter entirely) causes the sound to start playback immediately.
offset
可选
A floating-point number indicating the offset, in seconds, into the audio buffer where playback should begin. If 0 is passed then the playback will start from the beginning.
duration
可选
A floating-point number indicating the duration, in seconds, to be played. If no value is passed then the duration will be equal to the length of the audio buffer minus the offset value
InvalidStateNode
stop()
.
RangeError
当
为负。
This example demonstrates how to create an
OscillatorNode
which is scheduled to start playing in 2 seconds and stop playing 1 second after that. The times are calculated by adding the desired number of seconds to the context's current time stamp returned by
AudioContext.currentTime
.
context = new AudioContext(); osc = context.createOscillator(); osc.connect(context.destination); /* Schedule the start and stop times for the oscillator */ osc.start(context.currentTime + 2); osc.stop(context.currentTime + 3);
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 音频 API
The definition of 'start()' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
start
|
Chrome 14 | Edge ≤79 | Firefox 53 | IE 不支持 No | Opera 15 | Safari ? | WebView Android Yes | Chrome Android 18 | Firefox Android 25 | Opera Android 14 | Safari iOS ? | Samsung Internet Android 1.0 |
完整支持
不支持
兼容性未知
stop()
AudioScheduledSourceNode
AudioBufferSourceNode
ConstantSourceNode
OscillatorNode
AudioScheduledSourceNode
start()
stop()
AnalyserNode
AudioBuffer
AudioBufferSourceNode
AudioContext
AudioContextOptions
AudioDestinationNode
AudioListener
AudioNode
AudioNodeOptions
AudioParam
AudioProcessingEvent
AudioWorklet
AudioWorkletGlobalScope
AudioWorkletNode
AudioWorkletProcessor
BaseAudioContext
BiquadFilterNode
ChannelMergerNode
ChannelSplitterNode
ConstantSourceNode
ConvolverNode
DelayNode
DynamicsCompressorNode
GainNode
IIRFilterNode
MediaElementAudioSourceNode
MediaStreamAudioDestinationNode
MediaStreamAudioSourceNode
OfflineAudioCompletionEvent
OfflineAudioContext
OscillatorNode
PannerNode
PeriodicWave
StereoPannerNode
WaveShaperNode