AudioScheduledSourceNode

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2021.

AudioScheduledSourceNode 接口作为 web 音频 API 的一部分,是几种具有在特定时刻开始与停止能力的音频源节点接口的父接口。更具体地来说,这个接口定义了start()stop() 方法,以及onended事件

备注: 你不能直接创建AudioScheduledSourceNode。而是应该使用继承于它的子接口,如AudioBufferSourceNode, OscillatorNodeConstantSourceNode.

除非另有说明,基于AudioScheduledSourceNode节点的输出在没有播放时处于静默状态(这种状态在 start() 之前与 stop() 之后调用)。静默状态总是由一个全 0 值流组成。

Properties

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

Event handlers

onended

A function to be called when the ended event is fired, indicating that the node has finished playing.

Methods

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.

Specification

Specification
Web Audio API
# AudioScheduledSourceNode

Browser compatibility

BCD tables only load in the browser

See also