This program lets you cast YouTube videos to your TV using command line

This program lets you cast YouTube videos to your TV using command line

The ability to wirelessly cast a smartphone’s screen to other devices like a TV isn’t that difficult of an endeavor these days. In fact, when it comes to casting a YouTube video from your phone or tablet to your Smart TV, the little icon takes care of everything — from device discovery to seamless context switching. But in case you’re a command-line lover, you might want to see behind the curtain and take control of the whole casting routine through CLI. This is exactly what Marco Lucidi did and came up with a handy tool called ytcast.

What is ytcast?

Marco, a self-described twenty-something years old computer science enthusiast, who goes by the alias MarcoLucidi01 on GitHub, has coded the ytcast utility as a standalone replacement of the cast button. According to the developer, anyone can use the program to replicate the functionality of the “Play on TV” button right from the command-line interface. It is written in Go and you can run it on Windows, Linux, and macOS.

XDA VIDEO OF THE DAY

How ytcast works

Under the hood, ytcast uses the DIAL (DIscovery And Launch) protocol developed by Netflix and Google to handle the device discovery and app launching events. For targets that no longer use the DIAL protocol (e.g. Chromecast), the program also offers a manual pairing option powered by the “link with code” functionality of the YouTube on TV app. Next comes the screen identification part, for which the developer relied on the reverse-engineered YouTube Lounge API. Finally, it passes the video URL from the source device to the target screen.

Limitations

Since the project is in its infancy, there are a couple of shortcomings. The session handling is sometimes a hit or miss, especially due to the usage of undocumented APIs. The developer has yet to find a reliable way to pass YouTube playlist URLs through ytcast, but there’s a workaround that involves the youtube-dl executable. Last but not least, you may not find ytcast under the Settings > Linked devices menu.

Needless to say, the ytcast project is incredibly useful for power users. There’s a ton of potential, and we have to remember that it is clearly a beta quality software at this point. Once it reaches the stable milestone, it might be the best casting option for anyone who’s into scripting and automation.

Download ytcast

You can get started with ytcast by visiting the project’s GitHub repository. There are pre-compiled binaries hosted under the “Releases” section. Be sure to provide some feedback to help Marco perfect this program.

Download ytcast

About author

Skanda Hazarika
Skanda Hazarika

DIY enthusiast (i.e. salvager of old PC parts). An avid user of Android since the Eclair days, Skanda also likes to follow the recent development trends in the world of single-board computing.

We are reader supported. External links may earn us a commission.