简体   繁体   English

具有HLS流和视频JS的Access-Control-Allow-Origin

[英]Access-Control-Allow-Origin with HLS streaming and video JS

I'm using videoJs to play some HLS stream and video. 我正在使用videoJs来播放一些HLS流和视频。 It's working fine on phones, tablets and Safari but i'm having some troubles with chrome and Firefox 它在手机,平板电脑和Safari上运行良好,但我在使用Chrome和Firefox时遇到了一些麻烦

No 'Access-Control-Allow-Origin' header is present on the requested resource. 请求的资源上不存在“Access-Control-Allow-Origin”标头。 Origin 'xxxxxxx' is therefore not allowed access. 因此不允许原点'xxxxxxx'访问。

OR 要么

The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed. 'Access-Control-Allow-Origin'标头包含多个值'*,*',但只允许一个。 Origin 'xxxxxxx' is therefore not allowed access. 因此不允许原点'xxxxxxx'访问。

I tried to use Ben Alman PHP proxy ( http://benalman.com/projects/php-simple-proxy/ ) to get the M3U8 file with no success. 我尝试使用Ben Alman PHP代理( http://benalman.com/projects/php-simple-proxy/ )来获取M3U8文件但没有成功。

Also, I don't have access to the server hosting the file, so i can't change the Access-Control header. 此外,我无法访问托管该文件的服务器,因此我无法更改Access-Control标头。

I'm not a skilled web developer, so if anyone could help, it would be awesome. 我不是一个熟练的网络开发人员,所以如果有人能提供帮助,那就太棒了。 Thanks a lot. 非常感谢。

Try to verify if your server has CORS activated. 尝试验证您的服务器是否已激活CORS。 As long as you know the public ip of the server you can check it. 只要你知道服务器的公共IP,你就可以检查它。 http://client.cors-api.appspot.com/client http://client.cors-api.appspot.com/client

Then , what do you use for publishing your videos/live streams. 那么,你用什么来发布你的视频/直播流。 For example for wowza to work with videojs you have to set cors on wowza and not on the web server. 例如,对于使用videojs的wowza,你必须在wowza而不是web服务器上设置cors。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM