How to allow CORS request from Javascript in Adobe Media Server

江枫思渺然 提交于 2020-01-24 15:33:07

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/41158655/how-to-allow-cors-request-from-javascript-in-adobe-media-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!