在家中,我使用标准的消费类无线路由器,一切工作正常。
在工作中,我们使用思科无线网状网络,但事情并不像预期的那样工作:我一直在我的receiverListener中收到用于实例化ApiConfig对象的“不可用”消息。然而,在工作中,我可以播放YouTube视频和其他支持Chromecast的安卓应用程序。在工作中,我可以在Chrome浏览器上成功地进行tab。
我实现的代码与the official Google documentation中推荐的代码非常相似。
我的代码可以在here中看到。设置发生在第900行附近。以下是我正在做的核心工作,以防你不想深入研究这些代码:
window.addEventListener('load', function () {
function initializeCastApi() {
var sessionRequest = new chrome.cast.SessionRequest('F6ADC45B');
var apiConfig = new chrome.cast.ApiConfig(sessionRequest,
chromecastSessionListener, receiverListener);
chrome.cast.initialize(apiConfig, onChromecastInitSuccess, function onError() { });
}
if (!chrome.cast || !chrome.cast.isAvailable) {
setTimeout(initializeCastApi, 1000);
}
});
function chromecastSessionListener(e) {
chromecastSession = e;
}
function receiverListener(e) {
if (e === 'available') {
self.chromecastAvailable = true;
$('#chromecastButton').show();
}
}
function onChromecastInitSuccess() {
}
这是现场直播,所以你可以在this sample page上看到我所说的更多内容。
发布于 2014-02-13 08:13:49
您的工作网络,有代理服务器吗?
使用--no-proxy-server启动您的Chrome浏览器,看看这是否有帮助。
发布于 2014-02-14 22:57:57
我找到了另一篇关于这个话题的文章。我还没来得及检查,但等我到家后我会的:
它是通过Google Cast Developers Google+社区的一篇文章找到的:
例外:
如果您使用的是windows,并且有多个NIC,请注意这是Chrome中多个NIC的错误,它已在Chrome 33中修复。您可以切换到33,或使用解决方法:
- Alt-N to bring up "Advanced" Menu
- Advanced Settings, then move the Wi-Fi adapter to the top of the list.
发布于 2014-02-15 05:55:56
是的,让WiFi成为最重要的网络做到了这一点。嗯,不完全是!我禁用了所有的网络适配器,禁用了WiFi,然后在接收器回调中获得了“可用”。哇-呼。那是我生命中的6个小时,我再也回不来了。
https://stackoverflow.com/questions/21740867
复制