Skip to content

Connecting Hardware Buttons

Warning:Commercial Hardware tools and the eSDK are available only for approved partners

If the device has hardware buttons for things like "Play", "Pause", "Skip Track", etc., the application should use SpPlaybackXXX() functions to perform these actions in the Spotify Embedded SDK. The following table shows which functions exist and it also lists the corresponding callbacks and "getter" functions.

ActionFunctionCallback/EventGetter
PlaySpPlaybackPlay()kSpPlaybackNotifyPlaySpPlaybackIsPlaying()
PauseSpPlaybackPause()kSpPlaybackNotifyPlaySpPlaybackIsPlaying()
Skip to next trackSpPlaybackSkipToNext()kSpPlaybackNotifyPlayN/A
Skip to previous trackSpPlaybackSkipToPrev()kSpPlaybackNotifyPlayN/A
SeekSpPlaybackSeek()SpCallbackPlaybackSeek()SpPlaybackGetPosition()
VolumeSpPlaybackUpdateVolume()SpCallbackPlaybackApplyVolume()SpPlaybackGetVolume()
ShuffleSpPlaybackEnableShuffle()kSpPlaybackNotifyShuffleOn, kSpPlaybackNotifyShuffleOffSpPlaybackIsShuffled()
RepeatSpPlaybackEnableRepeat()kSpPlaybackNotifyRepeatOn, kSpPlaybackNotifyRepeatOffSpPlaybackIsRepeated()

Note: If the user is playing on another Connect-enabled device, the function SpPlaybackPlay will pull playback to the device. This way, pressing the "Play" button on the device has the same effect as pushing playback to the device by using the Spotify mobile app. The device will become the active device.