-
Notifications
You must be signed in to change notification settings - Fork 3
/
secure_video.php
37 lines (30 loc) · 1009 Bytes
/
secure_video.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
session_start();
$str = substr($_SESSION[$_GET['quality']][$_GET['video']], strpos($_SESSION[$_GET['quality']][$_GET['video']], '/upload'));
$path = __DIR__.$str;
$size=filesize($path);
$fm=@fopen($path,'rb');
$begin=0;
$end=$size;
header('HTTP/1.0 200 OK');
header("Content-Type: video/mp4");
header('Accept-Ranges: bytes');
header('Content-Length:'.($end-$begin));
header("Content-Disposition: inline;");
header("Content-Range: bytes $begin-$end/$size");
header("Content-Transfer-Encoding: binary\n");
header('Connection: close');
$cur=$begin;
fseek($fm,$begin,0);
while(!feof($fm)&&$cur<$end&&(connection_status()==0))
{ print fread($fm,min(1024*16,$end-$cur));
$cur+=1024*16;
usleep(1000);
}
die();
//$path = $_SESSION[$_GET['quality']][$_GET['video']];
// header("Cache-Control: no-store, no-cache, must-revalidate");
// header('Accept-Ranges: bytes');
// header("Content-Type:video/mp4");
// $output_file=readfile($path);
// print $output_file;