MediaSessionState

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.

The lock screen, the headset buttons, the car and the notification all read the same few facts. Working them out from a player snapshot is the part every application was writing again, and getting slightly wrong. This is that mapping's answer, and it holds no platform types, so it is testable on any target.

Constructors

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

Properties

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

Null for a live stream, where a scrub bar has nothing to scrub along.

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

False for a song. iOS names the media type on its card from this.

Link copied to clipboard
Link copied to clipboard

True only while sound is moving.

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