The start()
method of the AudioBufferSourceNode
Interface is used to schedule the start of the audio buffer playback.
var source = audioCtx.createBufferSource(); source.start(audioCtx.currentTime + 1,3,10);
The most simple example just starts the audio buffer playing from the beginning — you don't need to specify any parameters in this case:
source.start();
The following more complex example will start playing, after 1 second pause, a 10 second snippet of an audio buffer 3 seconds into the audio duration.
source.start(audioCtx.currentTime + 1,3,10);
Note: For a more complete example showing start()
in use, check out our AudioContext.decodeAudioData
example, You can also run the code example live, or view the source.
Void.
when
parameter defines when the play will start. If when
represents a time in the past, the play will start immediately. If the method is called more than one time, or after a call to AudioBufferSourceNode.stop()
, an exception is raised.offset
parameter, which defaults to 0
, defines where the playback will start.duration
parameter, which defaults to the length of the asset minus the value of offset
, defines the length of the portion of the asset to be played.Specification | Status | Comment |
---|---|---|
Web Audio API The definition of 'start()' in that specification. | Working Draft |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 14 webkit | (Yes) | 23 | No support | 15 webkit 22 (unprefixed) | 6 webkit |
Feature | Android | Chrome | Edge | Firefox Mobile (Gecko) | Firefox OS | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | No support | 28 webkit | (Yes) | 25 | 1.2 | No support | No support | 6 webkit |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/start