PlayerMediaSource

A packet cursor over one opened item. The engine closes it with its session.

Properties

Link copied to clipboard

Files the container carries beside its streams, Matroska attachments above all. Fonts are the ones that matter: a typeset ASS track ships the faces it was authored with, and the subtitle typesetter loads every MediaAttachment.isFont entry before it draws. Empty for a container that carries none, and for a source that cannot read them.

Link copied to clipboard
abstract val chapters: List<Chapter>

The container's chapters, in order. Empty when it has none.

Link copied to clipboard

What the container declares as its overall bit rate, in bits per second.

Link copied to clipboard
abstract val duration: Pts?

Null when unknown, for example a live stream.

Link copied to clipboard

True when duration is an estimate rather than a length the media states, such as FFmpeg's guess from the bit rate of an ADTS AAC file or of an MP3 without its Xing header, which for variable bit rate audio is minutes out (#422). The engine then cuts no seek, start position or clock at it, and once playback passes it, or ends before it, reports the length played.

Link copied to clipboard
abstract val metadata: Map<String, String>

Container-level tags. Never trusted, always reported. They can change during playback, and each change also arrives on the packet that brings it, as PlayerPacket.newContainerTags.

Link copied to clipboard

The channels of a multiplex, each a set of streams that play together, or empty when the container declares none (#505). Every io.github.yuroyami.kiteplayer.MediaProgram.tracks entry names one of streams by its index, and every number is one only that programme has. The engine lists them in io.github.yuroyami.kiteplayer.Tracks.programs and, when there are two or more, picks every track from one of them.

Link copied to clipboard
open val realTime: Boolean

True when a sender pushes this stream at the pace it plays, as RTSP, RTMP, UDP and RTP do.

Link copied to clipboard
abstract val seekable: Boolean

False when the source can only read forward, such as a live stream. The engine then refuses seeks.

Link copied to clipboard
open val selectedVariant: Int?

The io.github.yuroyami.kiteplayer.StreamVariant.index of the variant this source reads, or null.

Link copied to clipboard

True when each alternate sound arrives by a download of its own, as an HLS or a DASH audio rendition does (#455), rather than in the same bytes as the picture, as every track of a file does. Reading such a sound costs bandwidth whether anyone hears it or not, so the engine then reads only the sound being heard. A switch to another one reads it from the moment playing, by a seek of the reads that keeps what the other streams already hold when the source can seek, and the sound being heard goes on until the new one covers that moment.

Link copied to clipboard

Fields where the container's declaration and the decoder disagree.

Link copied to clipboard

Every stream the container declares, including streams this build cannot decode.

Link copied to clipboard

The seek bar pictures the media carries, such as a DASH thumbnail set or an HLS image playlist, or null when it carries none (#433). The engine lists them in io.github.yuroyami.kiteplayer.Tracks.thumbnails.

Link copied to clipboard

True when this container may contain timestamp discontinuities, MPEG-TS above all.

Link copied to clipboard

The versions of this media at other qualities, such as the variants of an HLS master playlist, or empty for media with one version. The engine lists them in io.github.yuroyami.kiteplayer.Tracks.variants.

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
open fun interrupt(): Boolean

Requests that a blocking call another lane is stuck inside return promptly with a typed failure, and that every later blocking call on this source fail fast.

Link copied to clipboard
open fun pauseReading(): Boolean

Tells the sender of a realTime stream that the player has stopped reading because it is paused (#441), and says whether the source has any notion of that: true when it has and is now paused, false when it has none, in which case nothing was sent and the source reads on.

Link copied to clipboard
abstract suspend fun readPacket(): PlayerPacket?

Reads the next packet from any selected stream.

Link copied to clipboard

Lifts a pauseReading: the sender plays on, which for a live stream is the live edge, so the engine drops what it had buffered before the pause and plays what arrives from here (#441). Called on the demux lane, only after a pauseReading that answered true.

Link copied to clipboard
abstract suspend fun seekToKeyframe(target: Pts): Pts?

Moves the read cursor to a keyframe at or before target.

open suspend fun seekToKeyframe(target: Pts, choice: KeyframeChoice): Pts?

Moves the read cursor to the keyframe choice names around target, under the same rules as the call without a choice.

Link copied to clipboard
abstract fun selectStreams(indices: Set<Int>)

Packets for streams outside this set are read and discarded by the source.