Update index.php
Browse files
index.php
CHANGED
@@ -1,5 +1,21 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
date_default_timezone_set("Asia/Shanghai");
|
3 |
+
$channel = empty($_GET['id']) ? "emdy4k_8000" : trim($_GET['id']);
|
4 |
+
$array = explode("_", $channel);
|
5 |
+
if (isset($array[1])) {
|
6 |
+
$stream = "http://[240e:944:6::22]/live2.rxip.sc96655.com/live/8ne5i_sccn,{$array[0]}_hls_pull_{$array[1]}K/";
|
7 |
+
} else {
|
8 |
+
$stream = "http://[240e:944:6::22]/live2.rxip.sc96655.com/live/8ne5i_sccn,{$array[0]}_hls_pull_4000K/";
|
9 |
+
}
|
10 |
+
$timestamp = intval((time() - 60) / 6);
|
11 |
+
$current = "#EXTM3U" . "\r\n";
|
12 |
+
$current .= "#EXT-X-VERSION:3" . "\r\n";
|
13 |
+
$current .= "#EXT-X-TARGETDURATION:6" . "\r\n";
|
14 |
+
$current .= "#EXT-X-MEDIA-SEQUENCE:{$timestamp}" . "\r\n";
|
15 |
+
for ($i = 0; $i < 6; $i++) {
|
16 |
+
$current .= "#EXTINF:6," . "\r\n";
|
17 |
+
$current .= $stream . rtrim(chunk_split($timestamp, 3, "/"), "/") . ".ts" . "\r\n";
|
18 |
+
$timestamp = $timestamp + 1;
|
19 |
+
}
|
20 |
+
header("Content-Disposition: attachment; filename=index.m3u8");
|
21 |
+
echo $current;
|