-
-
Save mindjek07/65a76310cb7c008fbfe2c11aa6748fc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id=$_GET['id']; | |
$files = glob("/hls/$id/*.m3u8"); | |
$co="#EXTM3U | |
#EXT-X-VERSION:3s"; | |
$start=""; | |
$lq=" | |
#EXT-X-STREAM-INF:BANDWIDTH=400000,RESOLUTION=426x240 | |
240p.m3u8"; | |
$sq=" | |
#EXT-X-STREAM-INF:BANDWIDTH=700000,RESOLUTION=640x360 | |
360p.m3u8"; | |
$mq=" | |
#EXT-X-STREAM-INF:BANDWIDTH=1250000,RESOLUTION=842x480 | |
480p.m3u8"; | |
$hq=" | |
#EXT-X-STREAM-INF:BANDWIDTH=2500000,RESOLUTION=1280x720 | |
720p.m3u8"; | |
$l=0;$s=0;$m=0;$h=0; | |
for($i=0;$i<count($files);$i++){ | |
$f= $files[$i]; | |
if (strpos($f, '240p.m3u8') !== false) { | |
$start.=$lq; | |
} | |
if (strpos($f, '360p.m3u8') !== false) { | |
$start.=$sq; | |
} | |
if (strpos($f, '480p.m3u8') !== false) { | |
$start.=$mq; | |
} | |
if (strpos($f, '720p.m3u8') !== false) { | |
$start.=$hq; | |
} | |
} | |
$content = $co.$start; | |
$fp = fopen($_SERVER['DOCUMENT_ROOT']."/hls/$id/$id.m3u8",'wb'); | |
fwrite($fp,$content); | |
fclose($fp); | |
$file="https://doamin.com/hls/$id/$id.m3u8"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment