我曾经能够在Chromecast测试版中获得接收者列表,但现在我不能...我错过了什么吗? [英] I used to be able to get a receiver list in the Chromecast beta, now I can't... Am I missing something?

查看:83
本文介绍了我曾经能够在Chromecast测试版中获得接收者列表,但现在我不能...我错过了什么吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月前,当我在Beta版中编写了一个简单的Chrome(浏览器)Chromecast应用时,我能够通过Javascript获取接收者列表,然后提示用户选择设备.

When I wrote a simple Chrome (Browser) Chromecast app in the beta a few months ago, I was able to get a list of receivers through Javascript, and then prompt the user to select the device.

现在,我似乎无法执行此操作,并且无法通过阅读API文档来弄清楚如何执行此操作.看来,我唯一能做的就是希望,并祈祷我的用户弄清楚如何单击浏览器中的chromecast按钮.

Now I can't seem to do this, and I can't figure out how to do this by reading the API docs. It seems that the only thing I can do is hope and pray that my user figures out how to click the chromecast button in the browser.

Youtube在视频旁边有一个Chromecast按钮.我想通过Javascript做同样的事情!

Youtube, however, has a chromecast button right next to the video. I'd like to do the same thing, via Javascript!

我该怎么做?

推荐答案

使用新的Chrome Sender Cast SDK,此调用

With the new Chrome Sender Cast SDK, this call

chrome.cast.requestSession(onRequestSessionSuccess,onLaunchError);

chrome.cast.requestSession(onRequestSessionSuccess, onLaunchError);

将始终触发Cast扩展程序以打开带有设备列表的弹出窗口,供用户选择和打开会话.不会有返回给您的应用的设备ID列表,开发人员可以对其进行迭代.

will always trigger the Cast extension to open a pop-up with a list of devices for users to select and open a session. There won't be a list of device IDs returned to your app that developers can iterate though.

如何触发此调用取决于开发人员,具体取决于您的用例.您有以下选择.-具有可点击的Cast图标(例如YouTube),用户单击该图标可触发此调用,然后用户会看到与Cast扩展程序相关的弹出式窗口,位于右上角-如果您的应用程序完全与Cast有关,并且希望用户立即选择设备,则在页面加载时触发此调用-请勿执行任何特殊操作来触发此通话.在这种情况下,当用户单击Cast扩展程序图标时,他们可以选择并连接到Cast设备.如果页面没有Cast集成,或者在页面加载时初始化Cast API时将创建Cast会话(或在存在时连接到Cast会话),则用户可以在此处进行选项卡镜像.

How to trigger this call is up to developers and depend on your use case. You have the following options. - Have a clickable Cast icon like YouTube that users click that triggers this call and then users see the pop-up to the top right corner associated with the Cast extension - Trigger this call upon your page load if your app is all about Cast and wants users to select a device right away - Don't do anything special to trigger this call. In this case when users click on the Cast extension icon, they can select and connect to a Cast device. From there, users can do tab mirror if your page has no Cast integration or a Cast session will be created (or connected to when existing) if you initialize Cast API upon page load.

这篇关于我曾经能够在Chromecast测试版中获得接收者列表,但现在我不能...我错过了什么吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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