MediaClip

data class MediaClip(val start: Duration = Duration.ZERO, val end: Duration? = null)

The part of a file a MediaItem plays, from start to end (#456). Both are positions of the whole file, as the item would report them with no clip.

A clipped item is an item of the clip's length. Every position and length the player reports for it counts from start: KitePlayer.position, KitePlayer.progress, PlayerSnapshot.duration, PlayerSnapshot.chapters, PlayerSnapshot.abLoopA and PlayerSnapshot.abLoopB, the markers, SleepTimer.At, PlayerEvent.SeekCompleted, PlayerMemento.position and MediaItem.startPosition, and every position the caller hands in is read the same way. A seek stays inside the clip. The item ends at end as an item ends at the end of its file, and the queue moves on. Nothing from before start or from end on is heard or shown, and a subtitle on screen at end leaves there. A clip whose end lies past the end of the media ends where the media does, and one that starts at or past the stated end of the media fails the open with PlaybackError.ConfigurationInvalid.

The timestamps of the media itself stay the file's: every Pts, such as the audio clock, a presented or captured frame, the audio tap and a scan, and the times of a subtitle cue. Add start to a position to get the timestamp that plays there, and take it away to go back.

Two items in a queue that are the same file, every field equal but the clip, the start position and the titles, where the second clip starts exactly where the first one ends, play as one stream: the player reads on through the boundary without opening the file again, so an album in one file plays its tracks with no gap and no seam, even in a lossy format. See docs/gapless-queue.md.

Throws

when start is negative or not finite, or when end is not finite or not after start.

Constructors

Link copied to clipboard
constructor(start: Duration = Duration.ZERO, end: Duration? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Where the item ends in the file, or null when it runs to the end of the file.

Link copied to clipboard

end in milliseconds, or null when the clip runs to the end of the file. For Java (#394).

Link copied to clipboard

How long the clip is, or null when it runs to the end of the file, whose length decides.

Link copied to clipboard

Where the item starts in the file.

Link copied to clipboard

start in milliseconds. For Java, which cannot read a Duration (#394).