在Chrome移动版上,创建新的ApiConfig时,接收方侦听器甚至无法触发。我在一年前创建了一个使用Chromecast Sender App API的webapp,它在桌面和移动Chrome上工作得很好。我可以从webapp投射视频并控制播放等。现在在移动Chrome上它无法加载接收器,而在桌面上它仍然按预期工作。我的代码中没有任何内容发生变化,所以我使用了演示版CastHelloVideo https://github.com/googlecast/CastHelloVideo-chrome来进行拍摄。
//code from CastHelloVideo
var apiConfig = new chrome.cast.ApiConfig(sessionRequest, sessionListener, receiverListener);
chrome.cast.initialize(apiConfig, onInitSuccess, onError);
...
function receiverListener(e) {
appendMessage('receiverListener()'); //never called
if (e === 'available') {
console.log('receiver found'); //never called
appendMessage('receiver found'); //never called
}
else {
console.log('receiver list empty'); //never called
appendMessage('receiver list empty'); //never called
}
}
//receiverListener never gets called yet onInitSuccess does
因此,Chromecast SDK已经发生变化,并且不会向后兼容移动Chrome,或者Chromecast SDK不再支持移动版,即使它仍然记录了它。或者我完全错过了一些东西。
有什么想法吗?