parent
9e85cb2a9c
commit
f1ef96514a
@ -1,19 +1,19 @@ |
||||
<?php |
||||
date_default_timezone_set("Asia/Shanghai"); |
||||
$channel = empty($_GET['id']) ? "cctv16hd4k/15000000" : trim($_GET['id']); |
||||
$array = explode("/", $channel); |
||||
$stream = "http://可用IP或域名/live/program/live/{$array[0]}/{$array[1]}/"; |
||||
$stream = "http://223.111.117.11/liveplay-kk.rtxapp.com/live/program/live/{$channel}/"; |
||||
$timestamp = substr(time(), 0, 9) - 7; |
||||
$current = "#EXTM3U" . "\r\n"; |
||||
$current .= "#EXT-X-VERSION:3" . "\r\n"; |
||||
$current .= "#EXT-X-TARGETDURATION:3" . "\r\n"; |
||||
$current .= "#EXT-X-MEDIA-SEQUENCE:{$timestamp}" . "\r\n"; |
||||
$current = "#EXTM3U" . PHP_EOL; |
||||
$current .= "#EXT-X-VERSION:3" . PHP_EOL; |
||||
$current .= "#EXT-X-TARGETDURATION:3" . PHP_EOL; |
||||
$current .= "#EXT-X-MEDIA-SEQUENCE:{$timestamp}" . PHP_EOL; |
||||
for ($i = 0; $i < 3; $i++) { |
||||
$timematch = $timestamp . '0'; |
||||
$timefirst = date('YmdH', $timematch); |
||||
$current .= "#EXTINF:3," . "\r\n"; |
||||
$current .= $stream . $timefirst . "/" . $timestamp . ".ts" . "\r\n"; |
||||
$current .= "#EXTINF:3," . PHP_EOL; |
||||
$current .= $stream . $timefirst . "/" . $timestamp . ".ts" . PHP_EOL; |
||||
$timestamp = $timestamp + 1; |
||||
} |
||||
header("Content-Disposition: attachment; filename=playlist.m3u8"); |
||||
echo $current; |
||||
header("Content-Type: application/vnd.apple.mpegurl"); |
||||
header("Content-Disposition: attachment; filename=index.m3u8"); |
||||
echo $current; |
||||
@ -1,16 +1,17 @@ |
||||
<?php |
||||
$channel = empty($_GET['id']) ? "CCTV1HD_6000" : trim($_GET['id']); |
||||
$stream = "http://liveyfs.yun.gehua.net.cn:8088/live/ipcdn,{$channel}K/"; |
||||
$stream = "http://111.31.122.45/yfsv.vsd.gehua.net.cn/live/ipcdn,{$channel}K/"; |
||||
$timestamp = intval((time()-60)/6); |
||||
$current = "#EXTM3U"."\r\n"; |
||||
$current.= "#EXT-X-VERSION:3"."\r\n"; |
||||
$current.= "#EXT-X-TARGETDURATION:6"."\r\n"; |
||||
$current.= "#EXT-X-MEDIA-SEQUENCE:{$timestamp}"."\r\n"; |
||||
$current = "#EXTM3U".PHP_EOL; |
||||
$current.= "#EXT-X-VERSION:3".PHP_EOL; |
||||
$current.= "#EXT-X-TARGETDURATION:6".PHP_EOL; |
||||
$current.= "#EXT-X-MEDIA-SEQUENCE:{$timestamp}".PHP_EOL; |
||||
for ($i=0; $i<6; $i++) |
||||
{ |
||||
$current.= "#EXTINF:6,"."\r\n"; |
||||
$current.= $stream.rtrim(chunk_split($timestamp, 3, "/"), "/").".ts"."\r\n"; |
||||
$current.= "#EXTINF:6,".PHP_EOL; |
||||
$current.= $stream.rtrim(chunk_split($timestamp, 3, "/"), "/").".ts".PHP_EOL; |
||||
$timestamp = $timestamp + 1; |
||||
} |
||||
header("Content-Type: application/vnd.apple.mpegurl"); |
||||
header("Content-Disposition: attachment; filename=index.m3u8"); |
||||
echo $current; |
||||
Loading…
Reference in new issue