AudioScheduledSourceNode

AudioScheduledSourceNode interface—part of the Web Audio API—is a parent interface for several types of audio source node interfaces which share the ability to be started and stopped, optionally at specified times. Specifically, this interface defines the start() and stop() methods, as well as the onended event handler.

You can't create an AudioScheduledSourceNode object directly. Instead, use the interface which extends it, such as AudioBufferSourceNode , OscillatorNode ,和 ConstantSourceNode .

Unless stated otherwise, nodes based upon AudioScheduledSourceNode output silence when not playing (that is, before start() is called and after stop() is called). Silence is represented, as always, by a stream of samples with the value zero (0).

特性

继承特性来自其父级接口 AudioNode .

方法

Inherits methods from its parent interface, AudioNode , and adds the following methods:

start()
Schedules the node to begin playing the constant sound at the specified time. If no time is specified, the node begins playing immediately.
stop()
Schedules the node to stop playing at the specified time. If no time is specified, the node stops playing at once.

Events

监听这些事件使用 addEventListener() 或通过把事件监听器赋值给 on eventname property of this interface:

ended
Fired when the source node has stopped playing, either because it's reached a predetermined stop time, the full duration of the audio has been performed, or because the entire buffer has been played.
Also available using the onended event handler property.

规范

规范 状态 Comment
Web 音频 API
The definition of 'AudioScheduledSourceNode' in that specification.
工作草案

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
AudioScheduledSourceNode Chrome 57
57
14 — 58
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
Edge ≤79 Firefox 53
53
25 — 53
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
IE 不支持 No Opera 44
44
15 — 44
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
Safari ? WebView Android 57
57
? — 58
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
Chrome Android 57
57
18 — 58
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
Firefox Android 53
53
25 — 53
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
Opera Android 44
44
14 — 44
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
Safari iOS ? Samsung Internet Android 7.0
7.0
1.0 — 7.0
Alternate Name
Alternate Name Uses the non-standard name: AudioSourceNode
ended event 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
onended 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
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 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

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
使用非标名称。
使用非标名称。

另请参阅