2013-09-25 59 views
2
  1. 已注册并接收来自Google的Chromecast AppId。
  2. 使用Chrome API实现了尽可能简单的发件人。
  3. 发件人的作品,如果我使用YouTube的AppId,但不是如果我使用Google发送给我的AppId。
  4. 已更新发件人以同时收听两者。我的Chromecast显示在YouTube列表中,但不显示在我的AppId列表中。

我相信我的发件人是正确的,但我的Chromecast未正确列入白名单。现在我该怎么做?如果我的Chromecast AppID无法使用,该怎么办?

JavaScript在我的sender.html中。我的AppID被混淆了。

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); 
    } 
}); 

回答

5

一个与Chromecast的发展开始时,我遇到的问题是,我忘了此设置:“检查更新时将这个Chromecast的序号。”如https://developers.google.com/cast/whitelisting#whitelist-receiver

中提到的我也必须重新启动Chromecast才能使设置生效,但之后我的Receiver正确显示。

+0

钉住它!谢谢!现在像魅力一样工作。 – FinnTheHuman

+0

这是否需要任何时间才能生效? –

+0

设置完成后,您是否重新启动了设备,然后再次确认设置? – Scarygami

相关问题