diff --git a/web/views/view_video.php b/web/views/view_video.php index 011343dc3..7c25fc83a 100644 --- a/web/views/view_video.php +++ b/web/views/view_video.php @@ -1,6 +1,6 @@ Path().'/'.$Event->DefaultVideo(); - ZM\Logger::Debug("Path: $path"); } else if ( ! empty($_REQUEST['event_id']) ) { $Event = new ZM\Event($_REQUEST['event_id']); $path = $Event->Path().'/'.$Event->DefaultVideo(); - ZM\Logger::Debug("Path: $path"); } else { $errorText = 'No video path'; } @@ -55,23 +53,21 @@ if ( $errorText ) { die(); } -$size = filesize($path); - -$fh = @fopen($path,'rb'); -if ( ! $fh ) { +if ( ! ($fh = @fopen($path,'rb') ) ) { header('HTTP/1.0 404 Not Found'); die(); } +$size = filesize($path); $begin = 0; $end = $size-1; $length = $size; if ( isset($_SERVER['HTTP_RANGE']) ) { - ZM\Logger::Debug('Using Range ' . $_SERVER['HTTP_RANGE']); + ZM\Logger::Debug('Using Range '.$_SERVER['HTTP_RANGE']); if ( preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches) ) { $begin = intval($matches[1]); - if ( ! empty($matches[2]) ) { + if ( !empty($matches[2]) ) { $end = intval($matches[2]); } $length = $end - $begin + 1; @@ -103,10 +99,10 @@ flush(); $cur = $begin; fseek($fh, $begin, 0); -while( $length && ( !feof($fh) ) && ( connection_status() == 0 ) ) { +while ( $length && ( !feof($fh) ) && ( connection_status() == 0 ) ) { $amount = min(1024*16, $length); - print fread( $fh, $amount ); + print fread($fh, $amount); $length -= $amount; # Why introduce a speed limit? #usleep(100);