logo
pub trait Playback: Disposable {
    fn volume(&self) -> AnimatedFloat;
    fn set_volume(&self, val: AnimatedFloat);
    fn paused(&self) -> bool;
    fn set_paused(&self, val: bool);
    fn complete(&self) -> Value<bool>;
    fn set_complete(&self, val: Value<bool>);
    fn position(&self) -> f32;
    fn set_position(&self, pos: f32);
    fn sound(&self) -> Rc<dyn Sound>;
}
Expand description

Represents a currently playing sound.

Required Methods

The volume of the sound being played, between 0 and 1 (inclusive).

Whether the playback is currently paused. Playbacks are automatically paused while the app is hidden, such as when minimized or placed in a background browser tab.

Whether the playback has finished playing or has been disposed. Looping playbacks will never complete naturally, and are complete only after being disposed.

In environments that don’t support audio, this will be true.

Do not set this value! To pause the playback, set paused. To stop it completely, call dispose().

The current playback position in seconds.

The sound being played.

Implementors