嗨,我正试图在jw播放器中使用PHP脚本加载远程m3u8,但我得到以下错误:播放列表无法加载:没有找到可播放的源谁能告诉我如何解决上述错误?
<script type="text/javascript" src="http://jwpsrv.com/library/xxxxxxxxxxxxxxx.js"></script>
<div id='player_1234'></div>
<script type='text/javascript'>
jwplayer('player_1234').setup({
file: "./get.php?url=2234",
provider: 'video',
width: "480",
height: "270",
controlbar: "bottom",
primary: "flash",
image: "./thumbs/test.jpg",
autostart: "true",
});
</script>
get.php:
<?php
header('Access-Control-Allow-Origin: *');
if (isset($_GET['url']) && preg_match('`^http://`', $_GET['url'])) {
echo file_get_contents('http://www.examplesite.com/'.$_GET['url'].'.m3u8');
}
?>
在JW6中,不再使用provider选项。
那么,修改这个:
provider: 'video',
:
type: 'hls',
你应该都准备好了!
问题是.php, jwplayer和大多数其他文件接受有限数量的文件扩展名。
你需要:
1。-在你的服务器上设置一个重写规则,以便foo。M3u8被发送到foo.php,然后通过它回送M3u8内容。或者,
2。-设置一个特定的子域,PHP解释器在其中解析m3u8文件并直接调用它们。
也不要忘记设置
header("Content-type: application/x-mpegURL");