[GH-ISSUE #750] Is it possible to tell Spotify to play to my chromecast using Spotipy? #456

Closed
opened 2026-02-27 23:22:43 +03:00 by kerem · 2 comments
Owner

Originally created by @Marterido on GitHub (Dec 1, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/750

I'm currently making a voice assistant in python to control different things inside my house including music. But I wondered if it's possible to stream my Spotify to the chromecast or another device using Spotipy?

Originally created by @Marterido on GitHub (Dec 1, 2021). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/750 I'm currently making a voice assistant in python to control different things inside my house including music. But I wondered if it's possible to stream my Spotify to the chromecast or another device using Spotipy?
kerem 2026-02-27 23:22:43 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@tikeyknax commented on GitHub (Dec 10, 2021):

I don't know about chromecast but I'm using it to stream spotify to Yamaha MusicCast devices. You can check which devices are available with the following code:

from pprint import pprint

import spotipy
from spotipy.oauth2 import SpotifyOAuth

scope = "user-read-playback-state,user-modify-playback-state"
sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope=scope))
print(sp.me())


def show_devices():
    # Shows playing devices
    res = sp.devices()
    pprint(res)
    for d in res["devices"]:
        print(f"{d['name']}: {d['id']}")
    
    return res["devices"][0]["id"]


if __name__ == '__main__':
    d_id = show_devices()

    sp.start_playback(
        device_id=d_id,
        uris=["spotify:track:2R6UrJ8uWbSIiHWmvRQvN8"])

EDIT: Added the start_playback command with which the streaming to a device can actually be started.

<!-- gh-comment-id:991326711 --> @tikeyknax commented on GitHub (Dec 10, 2021): I don't know about chromecast but I'm using it to stream spotify to Yamaha MusicCast devices. You can check which devices are available with the following code: ```python3 from pprint import pprint import spotipy from spotipy.oauth2 import SpotifyOAuth scope = "user-read-playback-state,user-modify-playback-state" sp = spotipy.Spotify(client_credentials_manager=SpotifyOAuth(scope=scope)) print(sp.me()) def show_devices(): # Shows playing devices res = sp.devices() pprint(res) for d in res["devices"]: print(f"{d['name']}: {d['id']}") return res["devices"][0]["id"] if __name__ == '__main__': d_id = show_devices() sp.start_playback( device_id=d_id, uris=["spotify:track:2R6UrJ8uWbSIiHWmvRQvN8"]) ``` EDIT: Added the start_playback command with which the streaming to a device can actually be started.
Author
Owner

@dieser-niko commented on GitHub (May 23, 2024):

Closing as the issue seems to be resolved.

<!-- gh-comment-id:2126294373 --> @dieser-niko commented on GitHub (May 23, 2024): Closing as the issue seems to be resolved.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#456
No description provided.