pychromecast
pychromecast copied to clipboard
Not able to cast Plex's Playlist to Chromecast - Error Message: "Sorry! something went wrong"
Hi, I used to cast all my plex contents including video playlists but it's been sometimes that I'm no longer able to cast playlists. Bellow you will find my code with which I can easily cast any movies or shows to Chromecast but not playlist. What I get on my Chromecast's plex app is a message that says "Sorry! something went wrong". Can somebody please let me know where I'm going wrong?
baseurl = 'http://192.168.1.192:32400' token = 'xxxxxxxxxxxxxxxxxxxxxxx' plex = PlexServer(baseurl, token) var1 = 'my playlist' device = '192.168.1.50' #The address of my chromecast
pxr = px.PlexApiController(plex) cast = pychromecast.Chromecast(device) cast.register_handler(pxr) cast.wait()
for video in plex.search(var1): content = video.title if video.TYPE == 'playlist': playlist = plex.playlist(content) pxr.block_until_playing(playlist) break elif video.TYPE == 'movie': mymovie = plex.library.section('Movies').get(content) pxr.block_until_playing(mymovie) break elif video.TYPE == 'show': show = plex.library.section('TV Shows').get(content) pxr.block_until_playing(show) break
I actually just overcame the same issue recently. I'm using the service media_player.play_media specifying 'plex://' as part of the content id for the service data (so as per the 'Cast' documentation current as of today).
I'm not home right now, but I saw in my HA logs something to the effect of 'failed to call service due to invalid SSL certificate'. I tried deleting and re-adding the plex integration, using the manual option so I could explicitly untick 'certificate verification' - it still failed due to being invalid.....so there may be a bug where it ignores the certificate verification flag......?
What got it working for me was the clue in the log (again not the exact wording):
'certificate for hostname '192-168-1-X.gobblediigook.plex.direct is not valid for server at 192.168.1.x:32400'
So I tried to access my plex using that hostname in a browser - I had to authenticate to Plex aain - but fine. I then added the integration again in HA using the hostname (no need for 'https://...' or port number that will be added by the tickbox 'uses SSL certificate' and port field, respectively). After that it worked.
I guess it means its accessing the plex server via the internet and not over my local LAN, but at least it works. Hope that helps you (10 months later...)