MediaItem

data class MediaItem(val uri: String, val headers: Map<String, String> = emptyMap(), val externalSubtitles: List<SubtitleSource> = emptyList(), val videoFilter: String? = null, val startPosition: Duration? = null, val io: MediaIoFactory? = null, val formatHint: String? = null, val openOptions: Map<String, String> = emptyMap(), val demux: DemuxPolicy = DemuxPolicy(), val title: String? = null, val artist: String? = null, val album: String? = null, val audioFilter: String? = null, val audioContent: AudioContent = AudioContent.Automatic, val clip: MediaClip? = null, val growth: FileGrowth? = null, val thumbnails: ThumbnailSource? = null)

What to play.

Constructors

Link copied to clipboard
constructor(uri: String, headers: Map<String, String> = emptyMap(), externalSubtitles: List<SubtitleSource> = emptyList(), videoFilter: String? = null, startPosition: Duration? = null, io: MediaIoFactory? = null, formatHint: String? = null, openOptions: Map<String, String> = emptyMap(), demux: DemuxPolicy = DemuxPolicy(), title: String? = null, artist: String? = null, album: String? = null, audioFilter: String? = null, audioContent: AudioContent = AudioContent.Automatic, clip: MediaClip? = null, growth: FileGrowth? = null, thumbnails: ThumbnailSource? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The album line, where a screen shows one. Null falls back to the file's album tag.

Link copied to clipboard

The line under title on those screens. Null falls back to the file's artist tag.

Link copied to clipboard

What the item's sound is, for the platform's sound processing: see AudioContent. The default declares a film when the item shows a picture, cover art aside, and music when it shows none. Name AudioContent.Speech for a podcast or an audiobook.

Link copied to clipboard

An audio filter chain attached at open: a raw FFmpeg chain like volume=0.5 or loudnorm. Every decoded audio buffer runs through it before the engine's own stages, so it works on untagged files, keeps pitch and speed apart, and can change the level or the key. Keep the chain's timing consistent with the audio it takes in; the buffers it gives back carry the timestamps FFmpeg puts on them. The web build has no filter graphs, so there an item with one fails to open with PlaybackError.ConfigurationInvalid rather than playing without it.

Link copied to clipboard

The part of the file this item is, or null for the whole file: a track of an album ripped to one file, a chapter played on its own, or any clip of a longer file (#456). The item is then an item of the clip's length, and every position and length the player reports for it counts from the clip's start. See MediaClip.

Link copied to clipboard

Typed settings for opening the container: how far to probe, what to do with damaged packets, low latency, and bytes to skip at the start. The default changes nothing. See DemuxPolicy.

Link copied to clipboard

Subtitle files to load alongside the media. Local SubRip and WebVTT files become selectable synthetic subtitle tracks; see SubtitleSource for the exact contract.

Link copied to clipboard

The demuxer to open the item with, by FFmpeg name, for example "mpegts" or "s16le". Almost never needed: probing is reliable.

Link copied to clipboard

Marks the file as still being written, as a recording in progress, a download that plays while it arrives or a TV recorder's file is (#430), or null, the default, for a file that is complete. See FileGrowth.

Link copied to clipboard

Request headers, for the http and https protocols. Passed to a configured or automatic MediaIoResolver when it supplies the transport. An external subtitle gets them only when it has the same scheme, host and port as uri; see SubtitleSource.

Link copied to clipboard

Read the bytes through your own code instead of through FFmpeg's protocols.

Link copied to clipboard

A short label for logs and for a UI that has nothing better to show: the file name alone. The query and the fragment are dropped, because that is where a signed URL keeps its signature, and the lock screen shows this label when the item has no title.

Link copied to clipboard

Demuxer options applied between allocation and open, the only moment probesize, fflags, format forcing and protocol options can act. Passed straight to the source's pre-open funnel; a key the demuxer does not consume is reported rather than silently dropped.

Link copied to clipboard

Where to start. Null means the beginning, or the container's own start time. With a clip it counts from the clip's start, as every position of a clipped item does, and null means the clip's start.

Link copied to clipboard

A WebVTT thumbnail file whose pictures a seek bar shows for this item, or null (#433). A stream that carries thumbnails of its own needs none: KitePlayer.thumbnailAt answers from this file when it is set, and from the stream otherwise. See ThumbnailSource.

Link copied to clipboard

The title the lock screen, the notification and the car show for this item. Null falls back to the file's own title tag, then to label. Nothing else reads it.

Link copied to clipboard
val uri: String

Where the media is: a file path, or an address.

Link copied to clipboard

A video filter chain attached at open: a compiled filter description, or a raw FFmpeg chain like scale=1280:720,eq=brightness=0.1. Every decoded frame runs through it before presentation. Filters run on SOFTWARE frames: under HwdecPolicy.Auto or Prefer the hardware route stands down with a warning, and under Require the video track is refused, because both demands cannot hold at once. Timebase-preserving chains only (scale, crop, eq, format and friends); runtime hot-swap is a documented non-goal.

Functions

Link copied to clipboard
open override fun toString(): String

The item without its secrets: the URI cut to label, and header and option names without their values. An Authorization header or a signed URL in a printed item is a leaked credential, and items get printed into logs.