SPTAppRemotePlayerAPI Protocol Reference

Conforms to NSObject
Declared in SPTAppRemotePlayerAPI.h

Overview

The SPTAppRemotePlayerAPI is used to interact with and control the Spotify player.

  delegate required method

The delegate receiving player state updates

@property (nonatomic, weak) id<SPTAppRemotePlayerStateDelegate> delegate

Declared In

SPTAppRemotePlayerAPI.h

– play:callback: required method

Asks the Spotify player to play the entity with the given identifier.

- (void)play:(NSString *)entityIdentifier callback:(nullable SPTAppRemoteCallback)callback

Parameters

entityIdentifier

The unique identifier of the entity to play.

callback

On success result will be YES. On error result will be nil and error set

Discussion

Note: Implement SPTAppRemotePlayerStateDelegate and set yourself as delegate in order to be notified when the the track begins to play.

Declared In

SPTAppRemotePlayerAPI.h

– playItem:callback: required method

Asks the Spotify player to play the provided content item.

- (void)playItem:(id<SPTAppRemoteContentItem>)contentItem callback:(nullable SPTAppRemoteCallback)callback

Parameters

contentItem

The content item to play.

callback

On success result will be YES. On error result will be nil and error set

Discussion

Note: Implement SPTAppRemotePlayerStateDelegate and set yourself as delegate in order to be notified when the the track begins to play.

Note: The playable property of the SPTAppRemoteContentItem indicates whether or not a content item is playable.

Declared In

SPTAppRemotePlayerAPI.h

– resume: required method

Asks the Spotify player to resume playback.

- (void)resume:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be YES. On error result will be nil and error set

Discussion

Note: Implement SPTAppRemotePlayerStateDelegate and set yourself as delegate in order to be notified when the the playback resumes.

Declared In

SPTAppRemotePlayerAPI.h

– pause: required method

Asks the Spotify player to pause playback.

- (void)pause:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be YES. On error result will be nil and error set

Discussion

Note: Implement SPTAppRemotePlayerStateDelegate and set yourself as delegate in order to be notified when the the playback pauses.

Declared In

SPTAppRemotePlayerAPI.h

– skipToNext: required method

Asks the Spotify player to skip to the next track.

- (void)skipToNext:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be YES. On error result will be nil and error set

Discussion

Note: Implement SPTAppRemotePlayerStateDelegate and set yourself as delegate in order to be notified when the the track changes.

Declared In

SPTAppRemotePlayerAPI.h

– skipToPrevious: required method

Asks the Spotify player to skip to the previous track.

- (void)skipToPrevious:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be YES. On error result will be nil and error set

Discussion

Note: Implement SPTAppRemotePlayerStateDelegate and set yourself as delegate in order to be notified when the the track changes.

Declared In

SPTAppRemotePlayerAPI.h

– seekToPosition:callback: required method

Asks the Spotify player to seek to the specified position.

- (void)seekToPosition:(NSInteger)position callback:(nullable SPTAppRemoteCallback)callback

Parameters

position

The position to seek to in milliseconds.

callback

On success result will be YES. On error result will be nil and error set

Declared In

SPTAppRemotePlayerAPI.h

– seekForward15Seconds: required method

Asks the Spotify player to seek forward 15 seconds. Note: You should only use this method if isEpisode = YES for the currently playing track

- (void)seekForward15Seconds:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be YES. On error result will be nil and error set

Declared In

SPTAppRemotePlayerAPI.h

– seekBackward15Seconds: required method

Asks the Spotify player to seek backward 15 seconds. Note: You should only use this method if isEpisode = YES for the currently playing track

- (void)seekBackward15Seconds:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be YES. On error result will be nil and error set

Declared In

SPTAppRemotePlayerAPI.h

– setShuffle:callback: required method

Asks the Spotify player to set shuffle mode.

- (void)setShuffle:(BOOL)shuffle callback:(nullable SPTAppRemoteCallback)callback

Parameters

shuffle

YES to enable shuffle, NO to disable.

callback

On success result will be YES. On error result will be nil and error will be set.

Declared In

SPTAppRemotePlayerAPI.h

– setRepeatMode:callback: required method

Asks the Spotify player to set the repeat mode.

- (void)setRepeatMode:(SPTAppRemotePlaybackOptionsRepeatMode)repeatMode callback:(nullable SPTAppRemoteCallback)callback

Parameters

repeatMode

The repeat mode to set.

callback

On success result will be YES. On error result will be nil and error will be set.

Declared In

SPTAppRemotePlayerAPI.h

– getPlayerState: required method

Asks the Spotify player for the current player state.

- (void)getPlayerState:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be an instance of idSPTAppRemotePlayerState On error result will be nil and error set

Declared In

SPTAppRemotePlayerAPI.h

– subscribeToPlayerState: required method

Subscribes to player state changes from the Spotify app.

- (void)subscribeToPlayerState:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be an instance of idSPTAppRemotePlayerState On error result will be nil and error set

Discussion

Note: Implement SPTAppRemotePlayerStateDelegate and set yourself as delegate in order to be notified when the the player state changes.

Declared In

SPTAppRemotePlayerAPI.h

– unsubscribeToPlayerState: required method

Stops subscribing to player state changes from the Spotify app.

- (void)unsubscribeToPlayerState:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be YES On error result will be nil and error set

Declared In

SPTAppRemotePlayerAPI.h

– enqueueTrackUri:callback: required method

Adds a track to the user’s currently playing queue

- (void)enqueueTrackUri:(NSString *)trackUri callback:(nullable SPTAppRemoteCallback)callback

Parameters

trackUri

The track URI to add to the queue

callback

On success result will be YES On error result will be nil and error set

Declared In

SPTAppRemotePlayerAPI.h

– getAvailablePodcastPlaybackSpeeds: required method

Asks the Spotify player for available podcast playback speeds

- (void)getAvailablePodcastPlaybackSpeeds:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be an NSArray of SPTAppRemotePodcastPlaybackSpeed objects On error result will be nil and error set

Declared In

SPTAppRemotePlayerAPI.h

– getCurrentPodcastPlaybackSpeed: required method

Asks the Spotify player for the current podcast playback speed

- (void)getCurrentPodcastPlaybackSpeed:(nullable SPTAppRemoteCallback)callback

Parameters

callback

On success result will be a SPTAppRemotePodcastPlaybackSpeed On error result will be nil and error set

Discussion

Note: Podcast playback speed is seperate from other contents' playback speed. This value is only used for podcasts

Declared In

SPTAppRemotePlayerAPI.h

– setPodcastPlaybackSpeed:callback: required method

Set the current podcast playback speed

- (void)setPodcastPlaybackSpeed:(nonnull id<SPTAppRemotePodcastPlaybackSpeed>)speed callback:(nullable SPTAppRemoteCallback)callback

Parameters

speed

The SPTAppRemotePodcastPlaybackSpeed to set as the current podcast playback speed

callback

On success result will be YES. On error result will be nil and error set

Discussion

Note: This playback speed will only affect podcasts and not other types of media. If you set this when a podcast is not playing this will be the default value when a podcast does begin to play. For this reason you may get a successful callback when setting this even when a podcast is not playing and the current playback speed does not change.

Note: You should use getAvailablePodcastPlaybackSpeeds: to get a list of valid speeds to pass to this method

Declared In

SPTAppRemotePlayerAPI.h