Web Audio API
AudioScheduledSourceNode 接口作为 web 音频 API 的一部分,是几种具有在特定时刻开始与停止能力的音频源节点接口的父接口。更具体地来说,这个接口定义了AudioScheduledSourceNode.start 和AudioScheduledSourceNode.stop 方法,以及AudioScheduledSourceNode.onended事件
[!NOTE] 你不能直接创建
AudioScheduledSourceNode。而是应该使用继承于它的子接口,如AudioBufferSourceNode, OscillatorNode和ConstantSourceNode.
除非另有说明,基于AudioScheduledSourceNode节点的输出在没有播放时处于静默状态(这种状态在 start() 之前与 stop() 之后调用)。静默状态总是由一个全 0 值流组成。
Properties
Inherits properties from its parent interface, AudioNode, and adds the following properties:
Event handlers
- AudioScheduledSourceNode.onended
- : A function to be called when the
endedevent is fired, indicating that the node has finished playing.
- : A function to be called when the
Methods
Inherits methods from its parent interface, AudioNode, and adds the following methods:
- AudioScheduledSourceNode.start
- : Schedules the node to begin playing the constant sound at the specified time. If no time is specified, the node begins playing immediately.
- AudioScheduledSourceNode.stop
- : Schedules the node to stop playing at the specified time. If no time is specified, the node stops playing at once.
Specification
Browser compatibility
See also
- Using the Web Audio API
- AudioNode
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
