kithara-queue
AVQueuePlayer-analogue orchestration layer on top of kithara-play. Owns
the queue (ordered tracks), an async track loader with a configurable
parallelism cap, navigation (shuffle / repeat / history), and
crossfade-aware track selection. Replaces the bespoke queue / controller
code previously duplicated across kithara-app and future iOS / Android
SDK surfaces.
Overview
[Queue] composes an Arc<PlayerImpl> (from kithara-play) with:
- an ordered
Vec<TrackEntry>indexed by stable [TrackId]s, - an async [
Loader] (internal) that caps in-flightResource::newcalls via atokio::sync::Semaphore, - [
NavigationState] for shuffle / repeat / history, - a
pending_selectslot soQueue::select(id)can be called before the track has finished loading.
[Queue] emits [QueueEvent] on the shared EventBus from
kithara-events, so subscribers receive queue-level signals and the
underlying player / audio / hls / file events through a single stream.
Key Types
- [
Queue::new(QueueConfig)] — the orchestrator: CRUD (append,insert,remove,clear,set_tracks), navigation (select,advance_to_next,return_to_previous, shuffle / repeat /seek), playback controls delegated toPlayerImpl, andtick()to drive the player and drain engine events. - [
TrackSource] — input toappend/insert/set_tracks, either aUri(String)(Queue builds a defaultResourceConfig) or aConfig(Box<ResourceConfig>)(caller-built, for DRM keys / headers / format hints).From<&str>/String/ResourceConfig/Box<ResourceConfig>are implemented. - [
QueueEvent] — queue-level signals delivered via [Queue::subscribe] alongside the underlying player / audio / hls / file events.
Minimal Usage
use Arc;
use ;
async
Queue::set_tracks must run inside an active tokio runtime because the
loader uses tokio::spawn.
See CONTEXT.md for detailed contracts, invariants, and internals.