コード例 #1
0
 function update($forceRecreation = false)
 {
     $this->cache = array();
     foreach ($this->playlist as $_playlistitem) {
         //Die Cachedateien falls nötig neu generieren
         if ($forceRecreation || !file_exists($this->getCacheFileName($_playlistitem['filename'])) && !file_exists($this->getLockFileName($_playlistitem['filename']))) {
             $this->lock($_playlistitem['filename']);
             $_fh = fopen($this->getCacheFileName($_playlistitem['filename']), 'w');
             fwrite($_fh, '<? $cache = array(');
             $_flv = new CustomFLV($this->getFLVFileName($_playlistitem['filename']));
             $_position = 0;
             $_second = 0;
             while ($_position >= 0) {
                 $_position = $_flv->getFramePosition($_second * 1000);
                 if ($_position >= 0) {
                     fwrite($_fh, $_position . ', ');
                     $_second++;
                     //die scriptlaufzeit verlängern
                     set_time_limit(30);
                 }
             }
             fwrite($_fh, ');?>');
             fclose($_fh);
             $this->unlock($_playlistitem['filename']);
         }
         //Die Daten aus den Cachedateien auslesen
         if (file_exists($this->getCacheFileName($_playlistitem['filename']))) {
             include $this->getCacheFileName($_playlistitem['filename']);
             $this->cache[] = $cache;
         }
     }
 }
コード例 #2
0
 function stream($video = "")
 {
     /*
     //aktuellen titel finden
     $currentTrack = count($this->playlist)-1;
     while(($currentTime < $this->playlist[$currentTrack]['starttime']) && ($currentTrack>0)){
     $currentTrack--;
     }
     
     //aktuelle sekunde des aktuellen titels herausfinden
     
     //aktuelle zeit - startzeit = laufzeit
     //laufzeit mod tracklänge = aktuelle position
     
     $runtime = $currentTime-$this->playlist[$currentTrack]['starttime'];
     $currentSecond = fmod($runtime,count($this->keyframecache->cache[$currentTrack]));
     
     $timeToRun = -1;
     //restlaufzeit für diesen titel berechnen
     if ((count($this->playlist)-1)>$currentTrack){
     $timeToRun = $this->playlist[$currentTrack+1]['starttime']-$currentTime;
     }
     $flv = new CustomFLV($this->getFLVFileName($this->playlist[$currentTrack]['filename']));
     $flv->setBrowserCaching(false);
     $flv->playFlv(1,$this->keyframecache->cache[$currentTrack][$currentSecond]);
     */
     if ($video == "") {
         $this->getPlaylistEntry($video, $nextVideoName, $nextVideoStartTime);
     }
     //		$fh = fopen('./tmp/test.log',w);
     //		fwrite($fh,strtotime("now").': Playing '.getConfigValue('videopath').$video);
     //		fclose($fh);
     //
     //		header("Content-Disposition: filename=".basename($video));
     //		header("Content-Type: video/x-flv");
     //		header("Content-Length: " .(string)filesize(getConfigValue('videopath').$video));
     //
     //        $fh = fopen(getConfigValue('videopath').$video,r);
     //        while (!feof($fh)){
     //			print(fread($fh, 1024));
     //        }
     //		fclose($fh);
     $flv = new CustomFLV(getConfigValue('videopath') . $video);
     //$flv->setBrowserCaching(false);
     $flv->playFlv();
 }