2013-11-22 177 views
1

我用jwplayer長時間運行m3u8 hls。我只是想通過php創建一個動態的m3u8。如果我直接在瀏覽器中粘貼php,我可以得到m3u8文件。我也在VLC中測試m3u8文件,沒有問題。Jwplayer玩m3u8生成的php

PHP:

<?php 
/* 
create m3u8 here 
*/ 
header("Content-type: application/text"); 
header("Content-Disposition: attachment; filename=index.m3u8"); 
echo $m3u8file; 
?> 

的M3U8文件輸出的位置:

#EXTM3U 
#EXT-X-KEY:METHOD=NONE 
#EXT-X-TARGETDURATION:10 
#EXT-X-MEDIA-SEQUENCE:138497571 

#EXTINF:10, 
ch22/2013112102/138497571.ts 
#EXTINF:10, 
ch22/2013112102/138497572.ts 
#EXTINF:10, 
ch22/2013112102/138497573.ts 
#EXTINF:10, 
ch22/2013112102/138497574.ts 
#EXTINF:10, 
ch22/2013112102/138497575.ts 
#EXTINF:10, 
ch22/2013112102/138497576.ts 
#EXTINF:10, 
ch22/2013112102/138497577.ts 
#EXTINF:10, 
ch22/2013112102/138497578.ts 
#EXTINF:10, 
ch22/2013112102/138497579.ts 
#EXTINF:10, 
ch22/2013112102/138497580.ts 
#EXT-X-ENDLIST 

該腳本將顯示在jwplayer 錯誤 「錯誤加載播放器: 沒什麼可玩的來源找到」

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>TEST</title> 
<script type="text/javascript" src="jwplayer/jwplayer.js"></script> 
<script type="text/javascript">jwplayer.key="xxxxxxxxxxxxx";</script> 
</head> 

<body> 
    <div class="player_box"> 
    <div id="player_outer"> 
    <div id="player" style="padding-top:100px;"></div> 
    </div> 
    <script> 
    jwplayer("player").setup({ 
     image: "", 
     file: "http://xxx.xxx.xxx.xxx/tvod/tvod.php?starttime=1384975713&endtime=1384975803", 
     width: '680', 
     height: '450', 
     autostart: true, 
    }); 
    </script> 
    </div></body> 
</html> 
+1

不知道如何幫助你,因爲你沒有包括你的播放列表文件輸出... – Brad

+0

我已經添加了輸出。謝謝 – Bunong

+0

@bunong。你能告訴我你是如何創建動態m3u8的嗎?我想學習「在這裏創建m3u8」部分,它爲echo生成$ m3u8file。你能告訴我如何做到這一點嗎?提前致謝。 – user1788736

回答