gpt4 book ai didi

javascript - 如何在 Adob​​e Media Server 中允许来自 Javascript 的 CORS 请求

转载 作者:行者123 更新时间:2023-11-29 21:12:20 25 4
gpt4 key购买 nike

我有一个 html 页面,从 javascript 调用 HLS。获取 header “allow-control-allow-origin”的 CORS 错误。我正在使用 Adob​​e Media Server 4.5。我如何允许来自 JavaScript 的 CORS 请求?

最佳答案

Adobe 媒体服务器使用 Apache HTTP 服务器。要启用 CORS,您需要将以下行添加到 Apache HTTP 服务器配置文件中:

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

您需要将“your_page_origin”替换为origin将发出请求的页面的名称,或带有“*”以允许来自任何域的请求。检查Enable CORS web siteConfiguring Apache HTTP Server documentation page获取更多信息。

此外,您还可以使用 HTML video 标签嵌入 HLS。当用户代理向video 源请求时,默认不会发送Origin header,也不会在服务器响应中搜索CORS 相关的header。在这种情况下,您不需要更改服务器配置。 Apple 建议在其 introduction to HTTP Live Streaming Overview 中使用 video 标签:

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

检查 How can I play Apple HLS live stream using html5 video tag thread获取更多信息。

关于javascript - 如何在 Adob​​e Media Server 中允许来自 Javascript 的 CORS 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41158655/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com