Trait AudioScheduledSourceNode

Source
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§

Source

fn start(&mut self)

Play immediately

§Panics

Panics if the source was already started

Source

fn start_at(&mut self, when: f64)

Schedule playback start at given timestamp

§Panics

Panics if the source was already started

Source

fn stop(&mut self)

Stop immediately

§Panics

Panics if the source was already stopped

Source

fn stop_at(&mut 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

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.

Implementors§