尝试获取会话时,Chromecast示例发件人应用程序CastHelloText-chrome以错误结尾 [英] Chromecast sample sender application CastHelloText-chrome ends with error when trying to get session

查看:100
本文介绍了尝试获取会话时,Chromecast示例发件人应用程序CastHelloText-chrome以错误结尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法启动类似于示例 CastHelloText-chrome 的Google-Cast应用程序。我为自己的特定目的略微修改了示例代码。创建此应用程序的目标是直接在Chromecast设备中发送和显示图像数据

I have problem with launching Google-Cast application similar to sample CastHelloText-chrome. I slightly modified example code for my specific purposes. The goal for creating this application is to send and show image data directly in Chromecast device.

特别是官方示例和我的代码之间的区别是消息格式及其内容,由发送方应用程序发送。发件人应用程序获取了base64编码的png图像,并通过带有自定义命名空间的消息总线进行发送。接收器应用程序收到此消息,并将其用作html对象< img> 的数据源。

Particularly the difference between official sample and my code is in message format and its content, sent by sender application. Sender application took png image coded by base64 and send through message bus with custom namespace. Receiver application get this message and use this as data source for html object <img>.

出现以下错误时我执行以下步骤:

Error appears when I do this steps:


  1. 重新加载发件人页面,检查控制台是否找到任何设备。

  2. 发送只需按下输入框上的Enter键即可输入表格(忽略文本)。

  3. 现在,Chromecast扩展程序弹出窗口显示出来。接下来有两种情况:

  1. Reload sender page, checking console if any device found.
  2. Send the form by just pushing enter on input box (text is ignored).
  3. Now a popup from Chromecast extension shows. Next there are two scenarios:

3a)我通过从列表中选择一个来确认投射到设备,然后在控制台中收到此错误消息:

3a) I confirm casting to device by choosing one from the list, then I get this error message in console:

onError:{代码: channel_error,描述:错误:超时,详细信息:空}

3b)我只是单击其他地方,出现此错误:

3b) I just click somewhere else, I get this error:

onError:{代码:取消, description:用户关闭的弹出菜单, details:null}

这两个错误均由调用函数引起第161行的 chromehellotext.html 中的chrome.cast.requestSession ,但我不知道什么是真正的错误。

Both of errors are caused by calling function chrome.cast.requestSession in chromehellotext.html at line 161, but what's really wrong I don't know.

当我执行发送方脚本时,我意识到从未调用过函数 sessionListener 。我知道代码尝试调用 chrome.cast.requestSession 时出了点问题,其中描述了错误。因此,如果我错过了正确使用Google-Cast API的方式,或者该问题与网络问题有关,我都需要帮助。

When I step sender script I realize that function sessionListener is never called. I know that something go wrong when code try to call chrome.cast.requestSession, where described error raises. So I need help if I missed about right way to use Google-Cast API or If this problem has something to do with networking issues.

接收器应用程序已在Google Cast上注册SDK Developer Console,我正在使用一些序列号在注册的设备上进行测试。我正在使用Canary版本42.0.2300.2(64位)和Chrome版本40.0.2214.111(我认为是目前稳定的版本)的Google Chrome。为了进行测试,我还尝试完全关闭Windows防火墙,但是没有运气。

Receiver application is registered on Google Cast SDK Developer Console and I'm testing on registered device with some serial number. I'm using Google Chrome in version 42.0.2300.2 canary (64-bit) and Chrome version 40.0.2214.111 (current stable I suppose). For testing I also tried to turn off Windows Firewall entirely but with no luck.

编辑:
有一些语法错误,导致上述错误消息。

There were some syntactic errors that caused error message described above.

推荐答案

对于最简单的教程,您可以看一下本教程。
在本教程中对此有很好的解释。
Chromecast发送器应用程序

For and easiest tutorial you can have a look to this tutorial. It is well explained in this tutorial. Chromecast Sender application

不需要自己维护会话。
只需添加按钮即可享受投射效果

There is no need to maintain session by yourself. just add button and enjoy casting

mCastManager.addMediaRouterButton(mediaRoutebtn);

这篇关于尝试获取会话时,Chromecast示例发件人应用程序CastHelloText-chrome以错误结尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆