Skip to main content

Crate kael_media

Crate kael_media 

Source
Expand description

Bounded audio playback and incremental video decoding primitives for Kael.

The crate accepts regular local files, in-memory bytes, repeatable reader factories, and credential-free HTTP(S) URLs through MediaSource. Remote reads have a 30-second I/O timeout. Applications that accept untrusted URLs must apply their own host and network policy. Byte and reader sources are staged in a private temporary directory only when FFmpeg needs a path; their staged files are removed when the last source clone is dropped.

AudioHandle is a UI-thread-local playback controller. Opening an output device, probing remote media, and fallback FFmpeg decoding are synchronous operations, so applications should keep potentially slow preparation off their UI thread. Common formats supported directly by Rodio stream into the output sink; the FFmpeg audio fallback is decoded into a bounded 128 MiB buffer. Video should normally be consumed incrementally with VideoFrameStream; individual decoded BGRA frames are also capped at 128 MiB.

Browser builds preserve the source and controller API while returning explicit unsupported errors for operations that require native decoding or audio output. URL playback is hosted by Kael’s browser media-element route.

§Example

use kael_media::{MediaSource, VideoFrameStream};

let mut frames = VideoFrameStream::new(MediaSource::file("clip.mp4"))?;
while let Some(frame) = frames.next_frame()? {
    // Upload `frame.data` (BGRA) to the application's renderer.
}

Structs§

AudioHandle
A clonable controller for audio playback.
MediaDecoder
A file-backed decoder for media metadata and video frames.
VideoFrame
A decoded video frame in BGRA format.
VideoFrameStream
A sequential decoder for file-backed video frames.
VideoMetadata
Metadata for a decoded video stream.

Enums§

AudioPlaybackError
An error that can occur while preparing or controlling audio playback.
MediaDecodeError
An error that can occur while decoding video content.
MediaSource
A source of media content that can be played back.
PlaybackState
The current playback state for a media handle.

Functions§

probe_audio_duration
Probe the total duration for an audio source without constructing a playback handle.