Has anyone successfully configured HASS to cast a YouTube video to a Chromecast via URL?

I found this cool post where someone created a script that plays a video over chromecast and sets the color of some lights:

They mentioned that they weren’t able to find out how to directly cast a YouTube video, so they downloaded the video and casted it from their device instead. I’d like to be able to directly cast a video from youtube.com (seems a lot easier than downloading videos and setting up a video server), so I’m wondering if anyone has been able to do this? With the media_player.play_media service, I tried many combinations of media_content_type and media_content_id, but never got it to play the URL video. The chromecast would change to the cast symbol, display a loading bar, and ‘load’, but nothing would play.

1 Like

Did you solve this?

It would be even better if you could cast a Youtube playlist

Sadly, I was never able to figure out how to do this. I’m hoping one day someone will post about doing this, but for now I’m looking for a work around.

Hey, know you’re looking for a chromecast option. I did it with my Roku and a curl request using their http services. Have not tried the following link yet for casting to chromecast from a command line, but might be worth a try: https://github.com/xat/castnow. If this works, set up a command line switch.

Update: Tried the following on my Raspberry Pi, it worked (took a little bit of playing around to figure it out): https://www.maketecheasier.com/stream-local-media-command-line-chromecast/

Did you come across this?