You may want to set their device to repeat or shuffle the current context. You could adjust the user’s queue and get their recently played tracks. This short tutorial should get you started experimenting with the Connect Web API but there are many more endpoints for you to explore. Most Connect Web API endpoints allow you to pass the device_id as a query parameter and while the API should use the currently active device, I find this helps reaffirm the action. In order to pause the current track, you simply call the /v1/me/player/pause endpoint. You can separately use the context_uri parameter in a similar manner to play albums, artists, and playlists. " -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" Once the user is logged in, you should get a list of their devices by making a request to the /v1/me/player/devices endpoint. You’ll want to make sure to authorize both the user-modify-playback-state and user-read-playback-state scopes. Check out the following blog for more info on how I implement authentication in this way. These tokens are short lived but should be fine for most web app implementations. Using this technique, we can simply popup the Spotify login dialog and obtain the user’s access token upon authorization. There are many ways to authorize a Spotify user on your app but I prefer implementing auth entirely in the browser using their Implicit Grant Flow. In this blog post, I’d like to share how you can integrate with this API to create a Spotify controller within your own web apps. While putting together a timed comments prototype for Spotify, I found myself taking a closer look at the Connect Web API again because I wanted the experiment to work from mobile devices. However, the Web Playback SDK has a major drawback in that it does not currently work from mobile devices. Of the two, I find myself using the Web Playback SDK most often in client projects because it is simple for a user to understand: login to stream. The Connect Web API acts more like a remote control, interacting with a copy of Spotify open on one the authenticated user’s devices.
The Web Playback SDK simply streams full tracks through your web app to an authenticated premium Spotify user. Spotify provides two ways for developers to stream music from a web app: the Web Playback SDK and the Connect Web API.