~codepaste
22 itemsDownload ./*


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


codepaste.VrFMQF
7 months agoDownloadRawClose


<?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 at openmailbox dot org
©twily.info 2013 - 2017



744 100 visits
... ^ v