问题描述
- 注册并从Google接收Chromecast AppId.
- 使用Chrome API实现了最简单的发件人.
- 如果我将YouTube用作AppId,则发送方有效,但如果我使用Google发送给我的AppId,则发送方无效.
- 更新后的发件人可以同时收听这两个消息.我的Chromecast显示在YouTube列表中,而不显示在我的AppId列表中.
我相信发件人是正确的,但我的Chromecast未正确列入白名单.我现在该怎么办?
I believe my sender is correct but my Chromecast was not correctly whitelisted. What do I do now?
JavaScript.我的AppID模糊不清.
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);
}
});
推荐答案
开始进行Chromecast开发时遇到的问题之一是我忘记进行以下设置:在检查更新时发送此Chromecast的序列号."如 https://developers.google.com/cast/whitelisting#whitelist-receiver
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
我还必须重新启动Chromecast才能使设置生效,但是之后我的Receiver会正确显示.
I also had to reboot the Chromecast for the setting to take effect, but afterwards my Receiver showed up correctly.
这篇关于如果我的Chromecast AppID无法使用,该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!