Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ChromeCast button with HTML and JavaScript [closed]

Tags:

chromecast

I'm currently building an website and I would like to have a feature that shows Google Cast. Is it possible with HTML and JavaScript, no complex things.

like image 255
Darren Paul Cassar Avatar asked Apr 13 '17 11:04

Darren Paul Cassar


1 Answers

Simply use the Chrome Sender API. From the Official Integration docs:

Cast Button

The Cast button component in your app is handled entirely by the framework. This includes visibility management, as well as click event handling. The button element tag requires the is='google-cast-button' attribute for it to be recognized by the framework.

<button is="google-cast-button"></button>

Alternatively, you can create the button programmatically:

document.createElement('button', 'google-cast-button')

You can apply any additional styling, such as size or positioning, to the element as necessary. Use the --connected-color attribute to choose the color for the connected receiver state, and --disconnected-color for the disconnected state.

Refer to the docs for more details.

like image 175
AL. Avatar answered Oct 12 '22 08:10

AL.