One Logo Pool Ball
MusicKit · IOS API REFERENCE

MusicPlayer.State

class · iOS 15.0+ · SDK 27.1

class State

An object that exposes the observable properties of a music player.

Members (9)

get · iOS 15.0+

repeatMode

TypeScript
get repeatMode(): (MusicPlayer_RepeatMode) | null
Swift declaration
var repeatMode: MusicPlayer.RepeatMode? { get set }

The current repeat mode of the music player. Defaults to `nil`.

set · iOS 15.0+

repeatMode

TypeScript
set repeatMode(value: (MusicPlayer_RepeatMode) | null)
Swift declaration
var repeatMode: MusicPlayer.RepeatMode? { get set }

The current repeat mode of the music player. Defaults to `nil`.

get · iOS 15.0+

shuffleMode

TypeScript
get shuffleMode(): (MusicPlayer_ShuffleMode) | null
Swift declaration
var shuffleMode: MusicPlayer.ShuffleMode? { get set }

The current shuffle mode of the music player. Defaults to `nil`.

set · iOS 15.0+

shuffleMode

TypeScript
set shuffleMode(value: (MusicPlayer_ShuffleMode) | null)
Swift declaration
var shuffleMode: MusicPlayer.ShuffleMode? { get set }

The current shuffle mode of the music player. Defaults to `nil`.

get · iOS 16.0+

audioVariant

TypeScript
get audioVariant(): (AudioVariant) | null
Swift declaration
var audioVariant: AudioVariant? { get }

The active variant that indicates the quality of audio for the current entry.

get · iOS 15.0+

playbackRate

TypeScript
get playbackRate(): number
Swift declaration
var playbackRate: Float { get set }

The current playback rate for the player. This value represents a multiplier for the default playback rate of the current entry. A value of `0.0` indicates that the entry isn’t playing, and a value of `1.0` indicates that it’s playing at normal speed. Positive values indicate forward playback, and negative values indicate reverse playback. Setting the value of this property changes the playback rate accordingly.

set · iOS 15.0+

playbackRate

TypeScript
set playbackRate(value: number)
Swift declaration
var playbackRate: Float { get set }

The current playback rate for the player. This value represents a multiplier for the default playback rate of the current entry. A value of `0.0` indicates that the entry isn’t playing, and a value of `1.0` indicates that it’s playing at normal speed. Positive values indicate forward playback, and negative values indicate reverse playback. Setting the value of this property changes the playback rate accordingly.

get · iOS 15.0+

playbackStatus

TypeScript
get playbackStatus(): MusicPlayer_PlaybackStatus
Swift declaration
var playbackStatus: MusicPlayer.PlaybackStatus { get }

The current playback status of the music player.

get · iOS 15.0+

objectWillChange

TypeScript
get objectWillChange(): _Combine_AnyPublisher<void, never>
Swift declaration
var objectWillChange: AnyPublisher<Void, Never> { get }

A publisher that emits before the object has changed.

Skipped declarations

No declarations were skipped in this snapshot.

All MusicKit types →