Reputation: 3374
I have a HTML 5 player app that has a requirement to load all of its skin elements programmatically.
I am attempting to add a Google Cast button to the skin. To do this I have the following code:
var castButton = document.createElement("button");
castButton.setAttribute("is", "google-cast-button");
this button is appended to the page and appears within the DOM on inspection. The problem I am having his that the framework des not recognise it as the cast button. So when clicking it no devices are listed.
In the chromecast chrome API docs it states cast docs that I can create the button using
document.createElement("button", "google-cast-button");
I am not able to use the second argument as I'm working in typescript and it has no knowledge of the second argument.
an example of the problem I am having in it's simplest form can be found here
When '__onGCastApiAvailable' is called by the framework when it has successfully loaded, the button should be set as the cast button but is not.
If I add a simple button to the HTML
<button id="cast-start" is="google-cast-button" style="width: 30px;"></button>
This works?
Is there something I'm missing or is the documentation wrong?
Upvotes: 1
Views: 376
Reputation: 3374
The issue was with Typescripts support for document.createElement(); see the below link for a more in depth discussion and solutiontypescript number of arguments error
Upvotes: 0
Reputation: 13469
You may check this support page which provides troubleshooting steps when you can't find the Cast button:
Also, you may first try this troubleshooter form from this page to help solve the most common issues causing missing devices.
Here's a sample CastButton.js.
Upvotes: 1