大家好,我正在尝试在 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>
获取.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');
}
?>