Reputation: 135
I believe my sender is correct but my Chromecast was not correctly whitelisted. What do I do now?
JavaScript in my sender.html. My AppID obfuscated.
var myID = 'df7cb8ba-a00b-476b-a9b5-xxxxxxxxxxxx';
var ytID = 'YouTube';
onYtReceiverList = function(list) {
$(".ytreceivers").html("<p>YouTube Receiver List</p>");
for (var i = 0; i < list.length; i++) {
$(".ytreceivers").append("<p>"+list[i].id+"<br/>"+list[i].name+"</p>");
}
};
onMyReceiverList = function(list) {
$(".myreceivers").html("<p>My Receiver List</p>");
for (var i = 0; i < list.length; i++) {
$(".myreceivers").append("<p>"+list[i].id+"<br/>"+list[i].name+"</p>");
}
};
window.addEventListener("message", function(event) {
if (event.source == window && event.data &&
event.data.source == "CastApi" &&
event.data.event == "Hello")
{
$("body").append("<p>Hello received</p>");
cast_api = new cast.Api();
cast_api.addReceiverListener(myID, onMyReceiverList);
cast_api.addReceiverListener(ytID, onYtReceiverList);
}
});
Upvotes: 2
Views: 1672
Reputation: 15569
One of the problems I had when starting with Chromecast development is that I forgot to make this setting: "Send this Chromecast's serial number when checking for updates." as mentioned at https://developers.google.com/cast/whitelisting#whitelist-receiver
I also had to reboot the Chromecast for the setting to take effect, but afterwards my Receiver showed up correctly.
Upvotes: 5