简体   繁体   中英

How to allow CORS request from Javascript in Adobe Media Server

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?

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"

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.

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 :

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

Check How can I play Apple HLS live stream using html5 video tag thread for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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