~codepaste
25 itemsDownload ./*

25 itemsDownload ./*

..
$.new.$
.AewnSE
.AswwGt
.EgDdGG
.GvWBvn
.HazjyQ
.MoeBwF
.OyUmVX
.SlBcrh
.VrFMQF
.aLmRfH
.bddjpX
.dApIeD
.fglWWW
.jnOsVi
.kcXFLt
.lkqoxo
.mlTNKY
.nRPJWO
.pGCvTq
.puKBTb
.tcIUFk
.wXufrS
.yuxVby
.zItQlU


codepaste.VrFMQF
1 550•  7 years ago•  DownloadRawClose
7 years ago•  1 550

{}
<?php

    // Usage:
    // <video><source src="./stream.php" type="video/webm;codecs='vp8,vorbis'"></video>
    //
    // https://en.wikipedia.org/wiki/Chunked_transfer_encoding
    // https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#transfer-encoding-response-header

    header("HTTP/1.1 206 Partial Content");
    header("Accept-Ranges: bytes");
    header("Content-Range: bytes 0-1000/9999");
    header("Content-Length: 5120");
    header("Transfer-Encoding: chunked");
    header("Content-Type: video/webm");
    header("Content-Disposition: attachment; filename=stream.webm");
     
    function flush_buffers(){
        ob_end_flush();
        ob_flush();
        flush();
        ob_start();
    }

    $file="./stream.webm";
     
    if(file_exists($file)) {
        $fh=fopen($file,'r');

        $old="";
        while(!feof($fh)) {
            rewind($fh);
            clearstatcache();
            $new=fread($fh,filesize($file));

            if($new!=$old) {
                $old=$new;
                echo $new;

                //echo "<hr />";
            }

            flush_buffers();
        }
        //stream_copy_to_stream($fh,'php://output');
        
        fclose($fh);
    }

    exit(1);

?>

Top
©twily.info 2013 - 2024
twily at twily dot info



2 030 244 visits
... ^ v