Sessions let one or more apps load and control playback of a cloud queue.
The playbackSession
namespace includes commands and events that enable apps to create a new session, or join an existing session in a group. Once your app has joined a session, it can load and start playback of an item in a cloud queue. Your app can also skip or seek to a specific item in a cloud queue, ask the group to re-fetch items in the cloud queue, or disconnect from the session. Your app can also get notified with a session error that your session was evicted or terminated at any time, for example, when another app starts playing something else.
The tables below list the commands and events available in the playbackSession
namespace.
Commands
Command | Description |
---|---|
subscribe |
Subscribe to events in the playbackSession namespace. |
unsubscribe |
Unsubscribe from events in the playbackSession namespace. |
joinOrCreateSession |
Join an existing session in the group if there is one. If there is no current session and no other source is playing, create a session and join it. |
createSession |
Unconditionally create a new session and clobber any existing sessions. |
joinSession |
Join an existing session in the group. |
loadCloudQueue |
Load and optionally start playback of an item in the cloud queue. |
loadStreamUrl |
Load and optionally start playback of a streaming (live) radio station URL. |
refreshCloudQueue |
Signal the group to re-fetch items in a cloud queue. |
skipToItem |
Skip to the track with the specified itemId in a cloud queue and optionally seek and initiate playback. |
seek |
Seek to the position in the track with the specified itemId in a cloud queue. |
seekRelative |
Seek to the relative position in the track with the specified itemId in a cloud queue. |
suspend |
Suspend the specified session. |
Event
Event | Description |
---|---|
sessionError |
A notification of session error status, such as failures to join, terminations, and evictions. |
sessionInfo |
A notification indicating whether a session is suspended or not. |
Object
Object | Description |
---|---|
sessionStatus |
Object returned by createSession , joinSession , and joinOrCreateSession when they succeed. |