'Does youtube player support to show cast button?

I'm writing a Android app to play youtube video by using Youtube API, I have a question how to show the "cast " button in Youtube player, if the API is available? if not, how can I cast the youtube video in my Android app to Chromecast or AndroidTV device?



Solution 1:[1]

YouTube player doesn't have the cast button and you cannot easily cast YouTube content from within your app. Currently, the only solution, is to write a custom receiver and embed YouTube html player in your receiver and then do some work to get things working to certain extent but it won't be a very good experience; for example, your users cannot skip ads, etc.

Solution 2:[2]

No, the youtube api does not have the cast button build-in. You can add the cast button to your app (outside the video player) - this guide can help with that: https://developers.google.com/cast/

Solution 3:[3]

You can add the Cast Button to Your App but not to the Youtube player.Make Use of this CodeLabs tutorial for casting Other than YT. Happy Coding..!!

Solution 4:[4]

Add follow parameter in iframe: enablecastapi=1

Be happy ;)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ali Naddaf
Solution 2 mthomas
Solution 3
Solution 4 Piero Ribeiro