home-assistant-libs / pychromecast

Library for Python 3 to communicate with the Google Chromecast.
MIT License
2.51k stars 380 forks source link

Join existing chromecast session without interrupting it? #804

Closed ImbanessItself closed 6 months ago

ImbanessItself commented 6 months ago

Hey folks,

I'm trying to implement a 'media remote control' via pychromecast but after connecting to the device I can't control (eg. pause/play/seek) the media on an existing session. I must start my own session to be able to control it, otherwise I get a "command requested but no session is active" error.

If I try to override the MediaController media_session_id with the cast session_id like below the command goes through but the active session gets disconnected (maybe session_id does not match media_session_id or I'm missing other params).

mc.status.update({"status" : {0 : { "mediaSessionId": cast.status.session_id }}})

Is there a way to control/join an existing session?