我最近安装了一个chrome-cast设备并在该设备上启用了调试器模式。将接收器应用程序发送到谷歌并从他们那里获得应用程序ID。
将应用程序ID设置为我的发件人应用程序,一切正常。但问题是我在调试器上看不到任何内容,无法在线调试我的代码。
http:// chrome-cast-ip:9222 /正在运行并向我显示调试器链接
https:// chrome-devtools-frontend.appspot.com/serve_rev/@185691/inspector.html?ws = .....
因此我的设备上没有问题或激活调试模式。
我还将调试级别设置为我的接收器应用程序
cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);
然而,这仍然不起作用,并没有向我显示任何内容。
http://i.stack.imgur.com/G2WJD.png
<script type="text/javascript">
window.onload = function() {
cast.receiver.logger.setLevelValue(cast.receiver.LoggerLevel.DEBUG);
//window.location.reload(true);
console.log('Starting Receiver Manager');
debugger;
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
// handler for the 'ready' event
castReceiverManager.onReady = function(event) {
console.log('Received Ready event: ' + JSON.stringify(event.data));
window.castReceiverManager.setApplicationState("Application status is ready...");
};
//debugger;
// handler for 'senderconnected' event
castReceiverManager.onSenderConnected = function(event) {
console.log('Received Sender Connected event: ' + event.data);
console.log(window.castReceiverManager.getSender(event.data).userAgent);
};
// handler for 'senderdisconnected' event
castReceiverManager.onSenderDisconnected = function(event) {
console.log('Received Sender Disconnected event: ' + event.data);
if (window.castReceiverManager.getSenders().length == 0) {
window.close();
}
};
// handler for 'systemvolumechanged' event
castReceiverManager.onSystemVolumeChanged = function(event) {
console.log('Received System Volume Changed event: ' + event.data['level'] + ' ' +
event.data['muted']);
};
// create a CastMessageBus to handle messages for a custom namespace
window.messageBus = window.castReceiverManager.getCastMessageBus('urn:x-cast:com.google.cast.sample.helloworld');
// handler for the CastMessageBus message event
window.messageBus.onMessage = function(event) {
console.log('Message [' + event.senderId + ']: ' + event.data);
// display the message from the sender
displayText(event.data);
// inform all senders on the CastMessageBus of the incoming message event
// sender message listener will be invoked
window.messageBus.send(event.senderId, event.data);
}
// initialize the CastReceiverManager with an application status message
window.castReceiverManager.start({statusText: "Application is starting"});
console.log('Receiver Manager started');
};
答案 0 :(得分:17)
您是否点击了网址框中星号旁边的盾牌图标?这样做并接受来自不安全来源的内容,这应该使它适合你。