PlayerMemento

data class PlayerMemento(val queue: List<MediaItem>, val queueIndex: Int, val position: Duration, val speed: Double, val preservePitch: Boolean, val volume: Float, val muted: Boolean, val loop: LoopMode, val shuffle: Boolean, val subtitleDelay: Duration, val audioDelay: Duration, val audioLanguage: String?, val subtitleLanguage: String?, val subtitlesOff: Boolean, val secondarySubtitleLanguage: String? = null, val balance: Float = 0.0f, val equalizer: EqualizerSettings = EqualizerSettings.Flat, val subtitleScale: Float = 1.0f, val subtitlePosition: Float = 1.0f, val forcedPicturesOnly: Boolean = false, val subtitleStyle: SubtitleStyleOverride? = null, val videoScale: VideoScale = VideoScale.Fit, val videoTransform: VideoTransform = VideoTransform.Identity, val videoAdjustments: VideoAdjustments = VideoAdjustments.Identity, val renderQuality: RenderQuality = RenderQuality.Off, val videoEnabled: Boolean = true, val queueOrder: List<Int> = emptyList(), val hdrPolicy: HdrPolicy = HdrPolicy.Auto, val stereoMode: StereoMode = StereoMode.Stereo, val nightMode: Boolean = false, val dialogueLevelDb: Float = 0.0f, val pitchSemitones: Double = 0.0, val skipSilence: Boolean = false)

Everything needed to come back to where playback was: the queue, the item, the position and every setting. Taken with KitePlayer.memento, handed back to KitePlayer.restore. A value the application stores however it likes; no serialisation is imposed. asProperties is a flat string form for applications that keep key-value text, and fromProperties reads it back.

What the text form cannot carry: MediaItem.io factories, which nobody can store, MediaItem.externalSubtitles, MediaItem.thumbnails, MediaItem.videoFilter and MediaItem.audioFilter. asProperties drops all five, and an item that needs one is rebuilt by the application before KitePlayer.restore. Headers, raw open options, the format hint, the demux settings, the start position, the clip, and the title, artist and album are strings and travel.

Tracks are remembered by LANGUAGE rather than by id, because ids belong to one open of one container and a memento outlives both.

Constructors

Link copied to clipboard
constructor(queue: List<MediaItem>, queueIndex: Int, position: Duration, speed: Double, preservePitch: Boolean, volume: Float, muted: Boolean, loop: LoopMode, shuffle: Boolean, subtitleDelay: Duration, audioDelay: Duration, audioLanguage: String?, subtitleLanguage: String?, subtitlesOff: Boolean, secondarySubtitleLanguage: String? = null, balance: Float = 0.0f, equalizer: EqualizerSettings = EqualizerSettings.Flat, subtitleScale: Float = 1.0f, subtitlePosition: Float = 1.0f, forcedPicturesOnly: Boolean = false, subtitleStyle: SubtitleStyleOverride? = null, videoScale: VideoScale = VideoScale.Fit, videoTransform: VideoTransform = VideoTransform.Identity, videoAdjustments: VideoAdjustments = VideoAdjustments.Identity, renderQuality: RenderQuality = RenderQuality.Off, videoEnabled: Boolean = true, queueOrder: List<Int> = emptyList(), hdrPolicy: HdrPolicy = HdrPolicy.Auto, stereoMode: StereoMode = StereoMode.Stereo, nightMode: Boolean = false, dialogueLevelDb: Float = 0.0f, pitchSemitones: Double = 0.0, skipSilence: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

The language of the audio track that was playing, or null when unknown or none.

Link copied to clipboard

Stereo balance. An accessibility setting, so it travels.

Link copied to clipboard

How far the dialogue was raised or lowered in a downmix, in decibels (#442). It travels.

Link copied to clipboard
Link copied to clipboard

Whether only the forced pictures of an image subtitle track drew (#513).

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Whether the night mode was on (#442). A listening setting, so it travels.

Link copied to clipboard

How far the pitch was moved, in semitones (#465). It travels with the speed.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The shuffled play order, as positions into queue, when shuffle was on. Empty when shuffle was off. KitePlayer.restore continues this order rather than drawing a new one, so the items already heard do not come round again.

Link copied to clipboard
Link copied to clipboard

The language of the second subtitle track that was showing, or null when none was.

Link copied to clipboard
Link copied to clipboard

Whether the silent stretches were shortened (#429). A listening setting, so it travels.

Link copied to clipboard
Link copied to clipboard

What the two front speakers played. An accessibility setting, so it travels (#462).

Link copied to clipboard
Link copied to clipboard

The language of the subtitle track that was showing, or null when unknown or none.

Link copied to clipboard
Link copied to clipboard

Subtitle size, place and styling. Accessibility settings, so they travel.

Link copied to clipboard

True when the media had subtitle tracks and none was selected: the viewer turned them off.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

False when the viewer was playing sound only.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Flat string pairs, version-stamped. Keys: version, queue.size, then per item queue.N.uri, queue.N.formatHint, queue.N.startPosition (microseconds), queue.N.clipStart and queue.N.clipEnd (microseconds) for a clipped item, queue.N.title, queue.N.artist, queue.N.album, queue.N.audioContent when it is not automatic, queue.N.header.<name>, queue.N.option.<key> and queue.N.demux.<field>; then queueOrder as space-separated positions when there is one, one key per setting, durations in microseconds, and audioLanguage and subtitleLanguage only when known.