Playback Control
The SDK provides direct control over the playback functionalities. For implementation details, please refer to the API reference documentation splayer_controls_api-3.h
.
The available commands are:
-
Play: Start or resume playback.
-
Pause: Pause the current track.
-
Skip: Skip to the next track in the queue.
-
Set Volume: Adjust the playback volume.
is_playing()
& is_paused()
To accurately manage your UI, it's crucial to understand the distinction between the player being paused and the player simply not playing music. In our system, is_playing() == false
does not always mean the player is in a paused state.
This situation occurs when the Scheduling feature is used to set periods of scheduled silence (non-active time slots). During these times, no music is supposed to play, but the player hasn't been explicitly paused by a user. In this "scheduled silence" state, both is_playing()
and is_paused()
will return false. Therefore, you must always check both is_playing()
and is_paused()
to determine the correct state of the player and update your playback controls accordingly.
State Logic
Use this table to understand the player's true state based on the API responses:
is_playing() |
is_paused() |
Player Status | UI Should Show |
---|---|---|---|
true |
false |
Playing | Pause Button |
false |
true |
Paused | Play Button |
false |
false |
Not Playing (Scheduled Silence) | Pause Button |
Extending Functionality with the Soundtrack API
For more advanced features that go beyond core playback control, you should use our cloud based API. This is the ideal solution if you need to build a companion app experience or implement features such as:
-
Browse playlists
-
Searching for specific songs or artists
-
Assign playlists and schedules to playback devices
To get started with advanced library and search controls, please see our Soundtrack API documentation.