Package-level declarations

Types

Link copied to clipboard

How long a player asks to hold the right to make sound for. See InterruptionPolicy.focus.

Link copied to clipboard

What playback should do when the application leaves the screen.

Link copied to clipboard

What the platform said happened to the right to make sound.

Link copied to clipboard
data class InterruptionPolicy(val pauseOnLoss: Boolean = true, val duckOnTransient: Boolean = true, val duckVolume: Float = 0.2f, val resumeAfterTransient: Boolean = true, val pauseWhenBecomingNoisy: Boolean = true, val focus: AudioFocusKind = AudioFocusKind.Permanent)

What to do when something takes the right to make sound away.

Link copied to clipboard

Keeps the process alive while the player plays, and holds the media notification.

Link copied to clipboard
class KitePlayerMediaSession(player: KitePlayer, context: Context, tag: String = "KitePlayer", skipInterval: Duration = 15.seconds) : AutoCloseable

Mirrors player into Android's media session and routes the buttons back.

class KitePlayerMediaSession(player: KitePlayer, skipInterval: Duration = 15.seconds) : AutoCloseable

Mirrors player into the iOS now playing card and routes its buttons back.

class KitePlayerMediaSession(player: KitePlayer, skipInterval: Duration = 15.seconds) : AutoCloseable

The desktop has no media session. This exists so code that builds one on every platform compiles here too; it mirrors nothing, and isAvailable is false.

class KitePlayerMediaSession(player: KitePlayer, session: JsAny? = navigatorMediaSession(), skipInterval: Duration = 15.seconds) : AutoCloseable

Mirrors player into the browser's media session and routes its buttons back.

Link copied to clipboard
data class MediaNotificationAction(val id: String, val label: CharSequence, val icon: Int)

A button of the application's own, in the media notification and in the system media controls. Give them to KitePlayerMediaSession.setCustomActions. The notification shows five buttons at most.

Link copied to clipboard

How the user put the media notification away. See MediaNotificationOptions.onDismissed.

Link copied to clipboard
data class MediaNotificationLabels(val previous: CharSequence = "Previous", val play: CharSequence = "Play", val pause: CharSequence = "Pause", val next: CharSequence = "Next")

The names of the notification's transport buttons, which a screen reader says. English by default.

Link copied to clipboard
data class MediaNotificationOptions(val smallIcon: Int, val channelId: String = "kiteplayer.playback", val channelName: CharSequence = "Playback", val notificationId: Int = 1, val contentIntent: PendingIntent? = null, val pausedForegroundTimeout: Duration = 10.minutes, val onForegroundRefused: (Throwable) -> Unit? = null, val wakeLocks: WakeLockPolicy = WakeLockPolicy.Network, val labels: MediaNotificationLabels = MediaNotificationLabels(), val onDismissed: (MediaNotificationDismissal) -> Unit? = null)

How the media notification looks and behaves. Only smallIcon has no default.

Link copied to clipboard

The four things a lock screen can show. Buffering is kept apart from paused, because a stalled stream that looks paused invites a press of play that does nothing.

Link copied to clipboard
data class MediaSessionState(val phase: MediaSessionPhase, val position: Duration, val duration: Duration?, val speed: Double, val canSeek: Boolean, val hasVideo: Boolean, val title: String?, val artist: String?, val album: String?, val hasNext: Boolean, val hasPrevious: Boolean)

What the platform's media session should show and accept, as one value.

Link copied to clipboard

What the media notification keeps awake while the player plays or buffers.

Functions

Link copied to clipboard
fun KitePlayerPlatform.attachBackgroundHandling(player: KitePlayer, context: Context, policy: BackgroundPolicy = BackgroundPolicy.ContinueAudio): AutoCloseable

Stops player decoding video for a screen nobody is looking at.

fun KitePlayerPlatform.attachBackgroundHandling(player: KitePlayer, policy: BackgroundPolicy = BackgroundPolicy.ContinueAudio): AutoCloseable

Stops player decoding video for a screen nobody is looking at.

fun KitePlayerPlatform.attachBackgroundHandling(player: KitePlayer, policy: BackgroundPolicy = BackgroundPolicy.ContinueAudio, pictureInPicture: KitePlayerPictureInPicture?): AutoCloseable

Stops player decoding video for a screen nobody is looking at, and keeps it on while the small window of pictureInPicture shows.

Link copied to clipboard

Makes player behave when something takes the sound away: a call, another app, or the headphones coming out.

Makes player behave when something takes the sound away: a call, another app, or the headphones coming out.

Link copied to clipboard

Shows session as a media notification and keeps playback going after the application leaves the screen.

Link copied to clipboard
fun KitePlayer.attachMediaSession(context: Context, notification: MediaNotificationOptions? = null, background: BackgroundPolicy? = BackgroundPolicy.ContinueAudio, interruptions: InterruptionPolicy? = InterruptionPolicy(), skipInterval: Duration = 15.seconds): KitePlayerMediaSession

Creates the media session for this player, with what an app needs for the lock screen and for background playback, and returns it.

fun KitePlayer.attachMediaSession(background: BackgroundPolicy? = BackgroundPolicy.ContinueAudio, interruptions: InterruptionPolicy? = InterruptionPolicy(), pictureInPicture: KitePlayerPictureInPicture? = null, skipInterval: Duration = 15.seconds): KitePlayerMediaSession

Creates the media session for this player, with what an app needs for the lock screen and for background playback, and returns it.

Creates the media session for this player. On the desktop JVM it mirrors nothing, as KitePlayerMediaSession says, so shared code keeps one call per platform.

Creates the media session for this player and returns it. It closes itself when the player closes. See KitePlayerMediaSession for what a browser shows.

Link copied to clipboard

Reads a snapshot and a progress sample into the state a platform session wants.