This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

stop

Summary

Schedules a sound to stop playback at an exact time, with options.

Method of apis/webaudio/AudioBufferSourceNodeapis/webaudio/AudioBufferSourceNode

Syntax

var  = AudioBufferSourceNode.stop(when);

Parameters

when

Data-type
Number

Describes at what time (in seconds) the sound should stop playing. It is in the same time coordinate system as AudioContext.currentTime. If 0 is passed in for this value or if the value is less than currentTime, then the sound will stop playing immediately. stop must only be called one time and only after a call to start or stop, or an exception will be thrown.

Return Value

Returns an object of type

Examples

Stop playing the sound immediately.

var source = audioCtx.createBufferSource();
source.stop();

Stop playing the sound after 3 seconds.

var source = audioCtx.createBufferSource();
source.stop(3);

Related specifications

Web Audio API
W3C Editor’s Draft