File size: 825 Bytes
bf62fb5 4260bb9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?php
date_default_timezone_set("Asia/Shanghai");
$channel = empty($_GET['id']) ? "cctv16hd4k/15000000" : trim($_GET['id']);
$stream = "http://223.111.117.11/liveplay-kk.rtxapp.com/live/program/live/{$channel}/";
$timestamp = substr(time(), 0, 9) - 7;
$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," . PHP_EOL;
$current .= $stream . $timefirst . "/" . $timestamp . ".ts" . PHP_EOL;
$timestamp = $timestamp + 1;
}
header("Content-Type: application/vnd.apple.mpegurl");
header("Content-Disposition: attachment; filename=index.m3u8");
echo $current; |