How to launch a receiver app in Chrome once Chromecast device has been whitelisted?

别等时光非礼了梦想. 提交于 2019-12-18 12:33:40

问题


I am trying to launch my custom receiver application from the Chrome browser. The first step in doing so appears to add a receiver listener for the activity type I'm interested in:

cast_api = new cast.Api();
cast_api.addReceiverListener(activityType, onReceiverList);

What should activityType be? I am able to put "YouTube" and "Netflix" and get a list of connected receivers, but when I put my whitelisted App-Id I do not get a list of Chromecast receivers. Is this something wrong with my whitelisting (perhaps giving an incorrect device serial code), or is it an incorrect understanding of what activityType means in the Chrome API?


回答1:


There's another possibility for why this isn't working. As mentioned in this answer, you have to have this setting turned on for your device in order for the whitelisting to work:

Send this Chromecast's serial number to Google when checking for updates




回答2:


Yes activityType is your AppID. This works for me.

It seems that the extension-injected code may scan the network for possible devices AND what Apps/"Activities" are available. When you whitelisted your device by serial number, Google associated that with an AppID as being allowed to be a "receiver" for it.

For example, the string "YouTube" works of course, and both of my devices were sent into the onReceiverList callback. If I changed activityType to my AppID, then only my developer whitelisted device would show up. If I changed activityType to a random string, no devices show up.



来源:https://stackoverflow.com/questions/17911932/how-to-launch-a-receiver-app-in-chrome-once-chromecast-device-has-been-whitelist

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!