Class

MusicKit.MusicKitInstance

This object provides access to a player instance, and through the player instance, access to control playback.

Declaration

interface MusicKit.MusicKitInstance

Overview

It also provides access to an api instance, and through the api instance, access to the Apple Music API, and contains methods for authenticating users. You don't create an instance or subclass it yourself.

Topics

Instance Properties

api

An instance of the MusicKit API.

bitrate

The current bit rate for the media player.

developerToken

The developer token to identify yourself as a trusted developer and member of the Apple Developer Program.

isAuthorized

A Boolean value indicating whether the user has authenticated and authorized the application for use.

musicUserToken

A user token used to access personalized Apple Music content.

playbackState

The current playback state of the music player.

playbackTargetAvailable

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

player

An instance of the MusicKit player.

storefrontId

The current storefront for the configured MusicKit instance.

Instance Methods

addEventListener

Add an event listener for a MusicKit instance by name.

authorize

Returns a promise containing a music user token when a user has authenticated and authorized the app.

changeToMediaAtIndex

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

pause

Pauses playback of the media player.

play

Begins playback of the current media item.

removeEventListener

Removes an event listener for a MusicKit instance by name.

seekToTime

Sets the playback point to a specified time.

setQueue

Sets a music player's playback queue using queue options.

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 playback of the media player.

unauthorize

Unauthorizes the app for the current user.

See Also

Configuring the Player

configure

Configure a MusicKit instance.

getInstance

Returns the configured MusicKit instance.

MusicKit.AppConfiguration

A configuration for an app.

MusicKit.Configuration

A dictionary used to configure the MusicKit instance.