Skip to main content

Crate moq_ext_player

Crate moq_ext_player 

Source
Expand description

A player over moq_video and moq_audio.

It picks the rendition the link can carry and keeps audio and video in step. Nothing here depends on iroh or on a publisher. A transport builds a RemoteBroadcast from what it subscribed to, and attaches its view of the link with RemoteBroadcast::set_network. A broadcast that lives in the same process is read with RemoteBroadcast::from_consumer.

§Examples

use moq_ext_player::{PlayerConfig, RemoteBroadcast};

let player = RemoteBroadcast::from_consumer(consumer).play(PlayerConfig::default())?;
let mut frames = player.video_frames();
while let Some(frame) = frames.next().await {
    // draw `frame`
}

The main types are:

A RemoteBroadcast that follows a route table looks for another route when its broadcast ends. A player adapts only to the network signals a transport attached. Without them, RenditionMode::Auto plays the best rendition its limits allow.

Dropping a Player aborts its tasks and returns at once. Dropping the last clone of a RemoteBroadcast aborts the task that follows it.

The futures of the crate and what dropping them does:

FutureSafeDropping it
VideoFrames::next, AudioFrames::next, RemoteBroadcast::closedyesloses nothing
RemoteBroadcast::catalog_withinyesstops waiting
RemoteBroadcast::mux_source (feature record)yesstops waiting

Structs§

Adaptation
The player’s adaptation thresholds and timers.
AudioFrame
One block of decoded audio, from Player::audio_frames.
AudioFrames
The decoded audio of a player, in the order it decodes.
AudioPlaybackStats
The audio decoder.
Catalog
A catalog track, created by a broadcaster to describe the tracks available in a broadcast.
Delay
How far behind the live edge a media reader plays: where it starts, and how late it may fall.
FrameTiming
When one frame arrived, left its decoder, and was presented.
NetworkSample
One reading of the link a broadcast arrives over.
PlaybackStats
What a Player is playing.
Player
One playback: video into VideoFrames, audio into the speaker and AudioFrames.
PlayerConfig
How a player plays.
PlayerStatus
The state of a player.
RemoteBroadcast
A broadcast being read.
SourceClosed
The source a FrameSender feeds has gone.
VideoBacklog
A queue of the pictures a Player presents, with their timing.
VideoFrames
Latest-frame-wins video frames.
VideoPlaybackStats
The video decoder.

Enums§

AudioMode
What a player does with the broadcast’s audio.
Error
An error from the media crates.
MediaKind
Which medium a FrameTiming describes.
RenditionMode
How the rendition is chosen.
SlotState
The state of one media slot, on a broadcast or on a player.

Constants§

DEFAULT_LATENCY
The latency of PlayerConfig::default: held for at least 100 ms, and skipped past 150 ms.
IMMEDIATE_LATENCY
No buffer and no pacing: a frame presents as soon as it decodes.

Functions§

video_rendition
Returns the video rendition of catalog named name.