Trait web_audio_api::node::AudioScheduledSourceNode
source · 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§
Provided Methods§
sourcefn set_onended<F: FnOnce(Event) + Send + 'static>(&self, callback: F)
fn set_onended<F: FnOnce(Event) + Send + 'static>(&self, callback: F)
Register callback to run when the source node has stopped playing
For all AudioScheduledSourceNode
s, 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.
sourcefn clear_onended(&self)
fn clear_onended(&self)
Unset the callback to run when the source node has stopped playing