pub trait AudioScheduledSourceNode: AudioNode {
    fn start(&self);
    fn start_at(&self, when: f64);
    fn stop(&self);
    fn stop_at(&self, when: f64);

    fn set_onended<F: FnOnce(Event) + Send + 'static>(&self, callback: F) { ... }
    fn clear_onended(&self) { ... }
}
Expand description

Interface of source nodes, controlling start and stop times. The node will emit silence before it is started, and after it has ended.

Required Methods§

source

fn start(&self)

Play immediately

Panics

Panics if the source was already started

source

fn start_at(&self, when: f64)

Schedule playback start at given timestamp

Panics

Panics if the source was already started

source

fn stop(&self)

Stop immediately

Panics

Panics if the source was already stopped

source

fn stop_at(&self, when: f64)

Schedule playback stop at given timestamp

Panics

Panics if the source was already stopped

Provided Methods§

source

fn set_onended<F: FnOnce(Event) + Send + 'static>(&self, callback: F)

Register callback to run when the source node has stopped playing

For all AudioScheduledSourceNodes, the ended event is dispatched when the stop time determined by stop() is reached. For an AudioBufferSourceNode, the event is also dispatched because the duration has been reached or if the entire buffer has been played.

Only a single event handler is active at any time. Calling this method multiple times will override the previous event handler.

source

fn clear_onended(&self)

Unset the callback to run when the source node has stopped playing

Implementors§