Skip to main content

Module audio

Module audio 

Source
Expand description

Audio playback abstraction for the engine’s media widgets.

The engine lays out and drives UI widgets such as the <audio> control, but it must not own an audio device: decoding, output device selection and stream management are platform concerns. This module defines the interface the engine uses to talk to whatever the host environment provides, mirroring crate::engine::bridge::text for text measurement.

§Responsibilities

  • Accept a media source (fetched bytes and/or a URI) and start playback
  • Expose transport controls (pause/resume) and playback position
  • Report whether the decoded source has finished

§Non-Responsibilities

  • Deciding when to play (the engine’s widget drives that)
  • Fetching media bytes (that goes through the resource loader)

§Data Flow

<audio> element → AudioSinkFactory → AudioSink → platform audio device

Structs§

NullAudioSinkFactory
A factory producing sinks that decode and play nothing.

Enums§

AudioError
Failures surfaced by an AudioSink.

Traits§

AudioSink
A single playable audio source.
AudioSinkFactory
Creates one AudioSink per media element.