如何在Adobe Media Server中允许来自Javascript的CORS请求 [英] How to allow CORS request from Javascript in Adobe Media Server

查看:101
本文介绍了如何在Adobe Media Server中允许来自Javascript的CORS请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个html页面,可从javascript调用HLS.标头"allow-control-allow-origin"的CORS错误.我正在使用Adobe Media Server 4.5. 我如何允许来自JavaScript的CORS请求?

I have a html page, calling HLS from javascript. Getting CORS error, of header "allow-control-allow-origin". I am using Adobe Media Server 4.5.   How can i allow CORS request from javascript?

推荐答案

Adob​​e Media Server使用Apache HTTP Server.要启用CORS,您需要在Apache HTTP Server配置文件中添加以下行:

Adobe Media Server use Apache HTTP Server. To enable CORS you need to add following line to Apache HTTP Server configuration file:

Header set Access-Control-Allow-Origin "your_page_origin"

您需要将起源,或带有"*"以允许来自任何域的请求.检查启用CORS网站

You need to replace "your_page_origin" with origin of the page that will make requests, or with "*" to allow requests from any domain. Check Enable CORS web site and Configuring Apache HTTP Server documentation page for more information.

此外,您可以使用HTML video标记嵌入HLS.当用户代理向video源发出请求时,默认情况下不会发送Origin标头,并且不会在服务器响应中搜索与CORS相关的标头.在这种情况下,您无需更改服务器配置. Apple建议在其 HTTP Live Streaming概述简介:

Also, you can use HTML video tag to embed HLS. When user agent makes request to video source it will not send Origin header by default, and it will not search for CORS-related headers in server response. You don't need to change server configuration in this case. Apple recommends to use video tag in their introduction to HTTP Live Streaming Overview:

重要:如果可能,请使用< video>标记以嵌入HTTP Live Streaming,并使用< object>或< embed>标签仅用于指定备用内容.

Important: Where possible, use the <video> tag to embed HTTP Live Streaming, and use the <object> or <embed> tags only to specify fallback content.

检查如何玩使用html5视频标签线程的Apple HLS实时流以获取更多信息.

这篇关于如何在Adobe Media Server中允许来自Javascript的CORS请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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