针对没有CORS的Chromecast进行开发 [英] Developing for Chromecast without CORS

查看:281
本文介绍了针对没有CORS的Chromecast进行开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为现有的视频流服务开发一个Chromecast应用。我们目前正在开发一个概念验证应用程序,将允许我们投射视频。

I am currently developing a Chromecast app for an existing video streaming service. We are currently developing a proof of concept app that will allow us to Cast video.

我已在Cast开发人员网站上阅读关于CORS的资讯此处。不幸的是,我没有访问需要更改头部的响应从我们的服务器或更新服务器上的cors.xml文件(我知道目前不存在)。

I have read on the Cast developers website about CORS here. Unfortunately, I do not have the access required to change headers on responses from our servers or update the cors.xml file on the server (Which to my knowledge currently does not exist).

我目前解决此问题的方法是通过Charles代理我的Chromecast的HTTP流量,并使用重写功能将所需的CORS标头添加到从其他来源请求的HLS文件。

My current work around to this problem is to proxy my Chromecast's HTTP traffic through Charles, and use the rewrite feature to add the required CORS headers to the HLS files being requested from other origins.

此解决方案适用于非安全内容,但是,我们还有内容通过HTTPS传递,上述解决方案不工作。

This solution works fine for non-secure content, however, we also have content being delivered over HTTPS, and the above solution does not work.

有没有任何方式,无论是否有代理,在白名单设备上开发Chromecast应用时,忽略,绕过或添加https响应中的CORS标题?

Is there any way, with or without a proxy, to ignore, bypass, or add CORS headers on https responses for the development of a Chromecast app on a whitelisted device?

解决方案可能是安装Charles证书,这将允许代理拦截HTTPS流量,并且Chromecast接受来自使用该证书的端点的连接,但我不请参阅在Chromecast上安装该证书的方法。

On solution might be to install the Charles certificate, that would allow the proxy to intercept HTTPS traffic and the Chromecast to accept connections from endpoints using that cert, but I do not see a way to install that certificate on the Chromecast.

另一个解决方案还可能是编写我们自己的中间服务,Chromecast命中,而不是我们的服务器,并返回视频流。

Another solution may also be to write our own intermediary service that the Chromecast hits, instead of our servers, and returns the video streams with the proper CORS implementation.

谢谢!

推荐答案

最好的办法是使用代理;如果https内容无法通过代理路由,您可能想将内容限制为http以进行开发,当您看到该工作时,开始使用您的CDN添加CORS头等。添加标题是不是一个难很多CDN的事情,因为他们已经做了,并且熟悉的过程,所以你可以联系他们,看看他们是否可以容纳你早。 CC侧没有快捷方式来禁用开发。

Your best bet is to use a proxy; if https content cannot be routed through the proxy, you might want to limit the content to http for development and when you see that working, start working with your CDN to add the CORS headers, etc. Adding headers is something that is not a hard thing for a lot of CDNs since they have been doing that already and are familiar with the process, so you may contact them and see if they can accommodate you earlier. There is no shortcut on the CC side to disable that for development.

这篇关于针对没有CORS的Chromecast进行开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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