Search code examples
androidgoogle-castchromecast

Open Chromecast YouTube video from my Android app


I'm able to use my own whitelisted url for feeding my chromecast videos, but can I make it stream a YouTube video directly from my app?

I assume all I would need is to launch the YouTube app remotely and feed it a video ID somehow, but I can't find out how to do that.

Has anyone done this from an Android app?

Thanks.


Solution

  • Not sure if you are still looking for a solution for this. The way to do it is as follows:

    MimeData data = new MimeData("v=g1LsT1PVjUA", MimeData.TYPE_TEXT);
    mSession.startSession("YouTube", data);
    

    The above should create a YouTube session and play the video.