[英]Custom headers with HTML5 video requests
I have a video resource sitting behind OAuth 2.0 wall and want to display it via <video>
tag. 我有一个视频资源位于OAuth 2.0墙后面,并希望通过<video>
标签显示它。 How can I send Authorization
header with video requests? 如何通过视频请求发送Authorization
标头?
我遇到了这个问题,并在url查询参数中发送了授权令牌(必须更改服务器端代码以允许从请求标头和请求查询参数中读取令牌): http://www.example.com/samplevideo?Authorization=sample_token
: http://www.example.com/samplevideo?Authorization=sample_token
Authorization = sample_token
As far as i know, you can't. 据我所知,你做不到。
But you can still use the error
attribute to check if the <audio>
element can fetch the video from JavaScript, and redirect to an authentication page if not. 但您仍然可以使用error
属性来检查<audio>
元素是否可以从JavaScript获取视频,如果没有,则重定向到身份验证页面。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.