2
- 已注册并接收来自Google的Chromecast AppId。
- 使用Chrome API实现了尽可能简单的发件人。
- 发件人的作品,如果我使用YouTube的AppId,但不是如果我使用Google发送给我的AppId。
- 已更新发件人以同时收听两者。我的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);
}
});
钉住它!谢谢!现在像魅力一样工作。 – FinnTheHuman
这是否需要任何时间才能生效? –
设置完成后,您是否重新启动了设备,然后再次确认设置? – Scarygami