请求使用 Bitmovin 播放器从服务器播放视频时,我正在尝试发送自定义标头。下面是我的代码
<!DOCTYPE html>
<html lang="en">
<head>
<title>TEST</title>
<meta charset="UTF-8"/>
<!-- bitdash player -->
<script type="text/javascript" src="https://bitmovin-a.akamaihd.net/bitmovin-player/stable/7.5/bitmovinplayer.js"></script>
</head>
<body background="http://bitmovin-a.akamaihd.net/webpages/bitmovin/images/background.jpg">
<div class="container">
<h1>HTML5 Adaptive Streaming Player for MPEG-DASH & HLS</h1>
<h2>Your videos play everywhere with low startup delay, no buffering and in highest quality.</h2>
<div id="webserver-warning">
<div class="ca-content">
<h1>Unsupported Protocol</h1>
<h2>This file has been loaded using the unsupported "file" protocol. Please use a <a href="http://wiki.selfhtml.org/wiki/Webserver/lokal" target="_blank">web server</a> and open this page using http or https.</h2>
</div>
</div>
<div class="content">
<div class="player-wrapper">
<div id="player"></div>
</div>
<div class="description">
<p>For more information about the bitmovin player, please have a look at our online <a href="//bitmovin.com/support" target="_blank">Developer Section</a>.</p>
</div>
</div>
</div>
<div id="player"></div>
<script type="text/javascript">
var conf = {
key: "b9c7c8b6-4af5-453e-8020-0a79672c6d5a",
source: {
hls: "//bitmovin-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8"
}
network: {
//Adding a custom header to each manifest request
preprocessHttpRequest: function (type, request) {
if (type === bitmovin.player.network.REQUEST_TYPE.MANIFEST_DASH) {
request.method = 'GET';
request.headers.push({
name: 'User-Agent',
value: 'Mozilla/5.0 (Windows NT 6.1; WOW64)'
});
return Promise.resolve(request);
}
}
}
};
var player = bitmovin.player("player");
player.setup(conf).then(function(value) {
// Success
console.log("Successfully created bitmovin player instance");
}, function(reason) {
// Error!
console.log("Error while creating bitmovin player instance");
});
</script>
</body>
</html>
但是播放器没有加载。怎么了 ?以及如何正确传递标题?或建议任何可以在向视频服务器请求期间发送自定义标头的播放器