pub trait AudioScheduledSourceNode: AudioNode {
// Required methods
fn start(&mut self);
fn start_at(&mut self, when: f64);
fn stop(&mut self);
fn stop_at(&mut self, when: f64);
// Provided methods
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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.