gpt4 book ai didi

google-cast - Chromecast 接收器应用程序错误 : The WebSocket disconnected unexpectedly: undefined

转载 作者:行者123 更新时间:2023-12-04 06:13:07 26 4
gpt4 key购买 nike

我正在尝试获取基本的 chromecast 应用程序设置,我可以在其中将简单的自定义消息从桌面 Chrome 发送到 Chromecast 接收器。设备已列入白名单,并且应用程序源位于白名单过程中指定的 url。此外,正在使用正确的 API_ID,并且接收方和发送方应用程序的 NAMESPACE 相同。

接收器应用程序加载,但之后我得到:

[  0.230s] [goog.net.WebSocket] The WebSocket disconnected unexpectedly: undefined

这似乎使我无法向 Chromecast 发送自定义消息。

从发送方应用程序中,我能够找到设备、连接并启动接收方应用程序。我还能够正确断开与发送方的 stopActivity() 调用的连接。

接收器的设置是:
var receiver = new cast.receiver.Receiver(APP_ID, NAMESPACE);
var channelHandler = new cast.receiver.ChannelHandler(NAMESPACE);

channelHandler.addChannelFactory(receiver.createChannelFactory(NAMESPACE));

channelHandler.addEventListener('error', function($e){
console.log('JAC - Error!');
});

channelHandler.addEventListener('open', function($e){
console.log('JAC - OnOpen!');
});

channelHandler.addEventListener('message', function($e){
console.log('JAC - Message: ' + $e.type);
});


receiver.start();

Chromecast 设备的完整日志是(实际的 appId 已删除):
[  0.027s] [cast.receiver.ChannelHandler] New channel factory added: MY-APP-ID to heartbeatChannelHandler
cast_receiver.js:66
[ 0.088s] [cast.receiver.ChannelHandler] New channel factory added: receiverTest1: MY-APP-ID to receiverTest1
cast_receiver.js:66
[ 0.094s] [cast.receiver.ConnectionService] Open connection service websocket: url=ws://localhost:8008/connection
cast_receiver.js:66
[ 0.098s] [goog.net.WebSocket] Opening the WebSocket on ws://localhost:8008/connection
cast_receiver.js:66
[ 0.104s] [cast.receiver.Receiver] Receiver started.
cast_receiver.js:66
[ 0.142s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.153s] [cast.receiver.ChannelOverWebSocket] Dispatch OPEN event to ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.159s] [cast.receiver.Channel] Dispatch OPEN event to ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.164s] [cast.receiver.Platform] Platform channel is open: ws://localhost:8008/system/control
cast_receiver.js:66
[ 0.208s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/connection
cast_receiver.js:66
[ 0.212s] [cast.receiver.ConnectionService] Got event: d
cast_receiver.js:66
[ 0.222s] [goog.net.WebSocket] The WebSocket on ws://localhost:8008/connection closed.
cast_receiver.js:66
[ 0.225s] [cast.receiver.ConnectionService] Got event: a
cast_receiver.js:66
[ 0.230s] [goog.net.WebSocket] The WebSocket disconnected unexpectedly: undefined

任何有关此事的帮助将不胜感激!谢谢!

最佳答案

NAMESPACE 的类型在 Receiver构造函数需要是一个数组。我猜在您的代码示例中它是一个字符串。这可能会导致您看到的奇怪问题。

关于google-cast - Chromecast 接收器应用程序错误 : The WebSocket disconnected unexpectedly: undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19191114/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com