我尝试用令牌系统保护我的视频,但我的播放器无法读取.php文件,你知道这是什么问题吗?
我的jwplayer:
<script type="text/javascript">jwplayer.key="mykey";</script>
<div id="player_div" style="outline:0px;">Loading...</div>
<script type="text/javascript">
var playerInstance = jwplayer("player_div");
playerInstance.setup({
abouttext: "Player",
aboutlink: "http://mywebsite.com",
autostart: "0",
startparam: "start",
aspectratio: "12:7",
width: "100%",
'type': 'mp4',
image: "/content/img/mp4-poster.jpg",
sources: [{
file: "test.php"
},{
file: "test.php",
"default": true,
}]
});
</script>
我的test.php:
clearstatcache();
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: video/mp4");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize("video.mp4"));
readfile("video.mp4");
答案 0 :(得分:2)
使用此代码代替源块:
sources: [{
file: "test.php",
type: "mp4"
}, {
file: "test.php",
"default": true,
type: "mp4"
}]