Class

MusicKit.Player

A media player that represents the media player for a MusicKit instance.

Declaration

interface MusicKit.Player

Overview

You don't create a player or subclass it yourself.

Topics

Instance Properties

bitrate

The current bit rate of the music player.

canSupportDRM

The music player has EME loaded.

currentPlaybackDuration

The current playback duration.

currentPlaybackProgress

The current playback progress.

currentPlaybackTime

The current position of the playhead.

formattedCurrentPlaybackDuration

The current playback duration in hours and minutes.

isPlaying

A Boolean value indicating whether the player is currently playing.

nowPlayingItem

The currently-playing media item, or the media item, within an queue, that you have designated to begin playback.

nowPlayingItemIndex

The index of the now playing item in the current playback queue.

playbackRate

The current playback rate for the player.

playbackState

The current playback state of the music player.

playbackTargetAvailable

A Boolean value that indicates whether a playback target is available.

queue

The current playback queue of the music player.

repeatMode

The current repeat mode of the music player.

shuffleMode

The current shuffle mode of the music player.

volume

A number indicating the current volume of the music player.

Instance Methods

addEventListener

Adds an event listener as a callback for an event name.

changeToMediaAtIndex

Begins playing the media item at the specified index in the queue immediately.

changeToMediaItem

Begins playing the media item in the queue immediately.

mute

Sets the volume to 0.

pause

Pauses playback of the current item.

play

Initiates playback of the current item.

prepareToPlay

Prepares a music player for playback.

seekToTime

Sets the playback point to a specified time.

showPlaybackTargetPicker

Displays the playback target picker if a playback target is available.

skipToNextItem

Starts playback of the next media item in the playback queue.

skipToPreviousItem

Starts playback of the previous media item in the playback queue.

stop

Stops the currently playing media item.

See Also

Media Playback

MusicKit.PlaybackBitrate

The playback bit rate of the music player.

MusicKit.PlaybackStates

The playback states of the music player.

MusicKit.PlayerRepeatMode

Possible values for the repeat mode for the music player.

MusicKit.PlayerShuffleMode

The shuffle mode for the music player.