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:
RemoteBroadcast: a subscribed broadcast and itsCatalog(hang’s).RemoteBroadcast::playstarts aPlayer.Player: decodes the chosen rendition and keeps audio and video in step.VideoFrames: the frame stream every renderer reads.VideoBacklog: a queue of every presented picture with its timing.AudioFrames: the decoded audio, for analysis or a custom output.RenditionMode: how the video rendition is chosen, re-exported frommoq_ext_adaptive.
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:
| Future | Safe | Dropping it |
|---|---|---|
VideoFrames::next, AudioFrames::next, RemoteBroadcast::closed | yes | loses nothing |
RemoteBroadcast::catalog_within | yes | stops waiting |
RemoteBroadcast::mux_source (feature record) | yes | stops waiting |
Structs§
- Adaptation
- The player’s adaptation thresholds and timers.
- Audio
Frame - One block of decoded audio, from
Player::audio_frames. - Audio
Frames - The decoded audio of a player, in the order it decodes.
- Audio
Playback Stats - 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.
- Frame
Timing - When one frame arrived, left its decoder, and was presented.
- Network
Sample - One reading of the link a broadcast arrives over.
- Playback
Stats - What a
Playeris playing. - Player
- One playback: video into
VideoFrames, audio into the speaker andAudioFrames. - Player
Config - How a player plays.
- Player
Status - The state of a player.
- Remote
Broadcast - A broadcast being read.
- Source
Closed - The source a
FrameSenderfeeds has gone. - Video
Backlog - A queue of the pictures a
Playerpresents, with their timing. - Video
Frames - Latest-frame-wins video frames.
- Video
Playback Stats - The video decoder.
Enums§
- Audio
Mode - What a player does with the broadcast’s audio.
- Error
- An error from the media crates.
- Media
Kind - Which medium a
FrameTimingdescribes. - Rendition
Mode - How the rendition is chosen.
- Slot
State - 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
catalognamedname.