mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 08:05:55 +03:00
[GH-ISSUE #728] start_playback not working properly. What am I doing wrong? #436
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#436
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @KartsaJaKoppa on GitHub (Sep 12, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/728
Hey,
I've been trying to build a voice controlled home assistant that could play music via spotify API. I have tried to play a specific song using start_playback and also directly calling https://api.spotify.com/v1/me/player/play. However every time I try to do so the player starts playing a song that I currently have paused and not the one I'm trying to specify using "context_uri" parameter.
Any help is appreciated!
Below is an example where the result is the same no matter if I change the uri:
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from pprint import pprint
from time import sleep
scope = "user-read-playback-state,user-modify-playback-state"
sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope=scope))
sp.start_playback(uris=['spotify:track:6rqhFgbbKwnb9MLmUQDhG6'])
@olsonap commented on GitHub (Oct 28, 2021):
Assuming you're setting your client ID and client secret values in the environment, try using the line below instead of what you have.
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
@Peter-Schorn commented on GitHub (Oct 28, 2021):
You claim you're using the "context_uri" parameter, but the code you posted uses the "uris" parameter. The "context_uri" parameter is used to specify the context in which to start playback, not the track/episode to play. Hence the term context. See here.
@Peter-Schorn commented on GitHub (Oct 28, 2021):
@olsonap That won't make any difference.
auth_manageris an alias forclient_credentials_manager.@olsonap commented on GitHub (Oct 28, 2021):
You're right. It looks like this code functions the way they want though. Perhaps they don't have spotify Premium.
.
@Peter-Schorn commented on GitHub (Oct 28, 2021):
Not having premium would result in a specific error indicating Premium is required. That's not the issue either.
@KartsaJaKoppa commented on GitHub (Nov 5, 2021):
Ahh I see, I need to specify the context and the tracks I want to play in that context. I will test this and close it out if I manage to make it work. Thank you so much! @Peter-Schorn