// pointer to read from file
    fseek($fp, $range1);
    $tempfp = $range1;
    if ($length == 0) {
        fwrite($fh, $length);
        fwrite($fh, "\n");
        die('Zero byte file! Aborting download');
    }
    while (!feof($fp) and connection_status() == 0) {
        set_time_limit(0);
        ignore_user_abort(true);
        if ($tempfp > $range2) {
            break;
        }
        print fread($fp, $maxSpeed);
        $tempfp = $maxSpeed + $tempfp;
        $count++;
        flush();
        ob_flush();
        sleep(0);
    }
    fwrite($fh, $count * $maxSpeed);
    fwrite($fh, "\n");
    fclose($fh);
    fclose($fp);
}
$videolocation = $_GET['fileloc'];
$rate = $_GET['rate'];
$log = $_GET['logfile'];
loadvideo($videolocation, $rate, $log);
Example #2
0
function getitembyitag($vid, $itag)
{
    loadvideo($vid);
    $vlist = formatVListByType($_SESSION['vurl_' . $vid], $itag, "itag");
    return $vlist[0];
}
Example #3
0
    /*
    file_put_contents('TMPB.LOG',"CAUGHT HEADER\r\n******************\r\n{$header}\r\n***************\r\n",FILE_APPEND);
    if(preg_match('/(Content-Length|Content-Range|Content-Type|Content-Type|Accept-Ranges|X-Content-Type-Options):(.*)/si',$header,$arr)){
    	@header($arr[1].": ".trim($arr[2]));
    }
    */
    if (!strpos($header, "Cache") && !strpos($header, "ocation")) {
        @header(substr($header, 0, strpos($header, "\r")));
    }
    return strlen($header);
}
$loadedsize = 0;
if (isset($_GET['id'])) {
    $vid = $_GET['id'];
    include 'nglib.php';
    loadvideo($vid, isset($_GET['type']) ? $_GET['type'] : "");
    $file_path = $_SESSION['vurl_' . $vid][0];
    if (isset($_GET['type'])) {
        $file_path = getitembytype($vid, $_GET['type']);
    }
    if (isset($_GET['q'])) {
        $file_path = getitembyitag($vid, $_GET['q']);
    }
    $file_path = $file_path["url"];
    /*file_put_contents('TMPB.LOG',date("\r\nY-m-D H:i:s  ").$vid."\r\n",FILE_APPEND);
    	file_put_contents('TMPB.LOG',$file_path."\r\n",FILE_APPEND);
    	file_put_contents('TMPB.LOG',$_SERVER['HTTP_RANGE']."<<RANGE\r\n",FILE_APPEND);*/
    if (isset($_GET['begin'])) {
        $file_path = $file_path . '&begin=' . $_GET['begin'];
    }
    //DEBUG:
Example #4
0
        header("Content-Range: bytes {$range}{$size2}/{$size}");
    } else {
        $size2 = $size - 1;
        header("Content-Range: bytes 0-{$size2}/{$size}");
        header("Content-Length: " . $size);
    }
    if ($size == 0) {
        die('Zero byte file! Aborting download');
    }
    set_magic_quotes_runtime(0);
    $fp = fopen("{$fileLocation}", "rb");
    fseek($fp, $range);
    while (!feof($fp) and connection_status() == 0) {
        set_time_limit(0);
        ignore_user_abort(true);
        $temp = fread($fp, 1 * $maxSpeed);
        $count++;
        print $temp;
        flush();
        ob_flush();
        if ($count > 20000) {
            sleep(10);
        } else {
            sleep(0);
        }
    }
    fclose($fp);
    return connection_status() == 0 and !connection_aborted();
}
loadvideo('../../../../../../../resources/media/misc/bbb_256kbps.ogg');
Example #5
0
        header("Content-Range: bytes {$range}{$size2}/{$size}");
    } else {
        $size2 = $size - 1;
        header("Content-Range: bytes 0-{$size2}/{$size}");
        header("Content-Length: " . $size);
    }
    if ($size == 0) {
        die('Zero byte file! Aborting download');
    }
    set_magic_quotes_runtime(0);
    $fp = fopen("{$fileLocation}", "rb");
    fseek($fp, $range);
    while (!feof($fp) and connection_status() == 0) {
        set_time_limit(0);
        ignore_user_abort(true);
        $temp = fread($fp, 1 * $maxSpeed);
        $count++;
        print $temp;
        flush();
        ob_flush();
        if ($count > 20000) {
            sleep(10);
        } else {
            sleep(0);
        }
    }
    fclose($fp);
    return connection_status() == 0 and !connection_aborted();
}
loadvideo('../../../../../../../resources/media/xiph/theora_testsuite/320x240.ogg');
Example #6
0
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="2">
  <tr>
  	<td width="20%" rowspan="2" valign="top"><iframe allowtransparency="true" frameborder="0" src="http://ng.laobubu.net/support/ad/lite.php" width="100%" height="100%"></iframe></td>
    <td width="60%" align="center">
	<?php 
if (!isset($_SESSION["html5"]) && isset($_COOKIE["html5"])) {
    $_SESSION["html5"] = $_COOKIE["html5"];
}
if (isset($_GET["html5"])) {
    $_SESSION["html5"] = $_GET["html5"];
    setcookie("html5", $_GET["html5"], time() + 3600 * 24 * 365);
}
?>
	<?php 
if ($_SESSION["html5"] == "on") {
    loadvideo($key, "webm,mp4");
    ?>
    <div id="html5switch" align="right"><a href="?html5=off&type=watch&uri=<?php 
    echo $key;
    ?>
">返回普通模式</a></div>
    <video controls="controls" preload="none" style="width:95%" poster="?type=thumb&uri=<?php 
    echo $key;
    ?>
">
		<?php 
    $vlist = formatVListByType($_SESSION['vurl_' . $key], "medium", "quality", 1);
    foreach ($vlist as $i) {
        ?>
        <source type='<?php 
        echo $i["type"];