Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Bug video reading issue with the http range
Browse files Browse the repository at this point in the history
Should fix #954
  • Loading branch information
leobouilloux committed Sep 8, 2015
1 parent 9222b39 commit 2055608
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/plugins/editor.video/class.VideoReader.php 100644 → 100755
Expand Up @@ -75,7 +75,8 @@ public function switchAction($action, $httpVars, $filesVars)
$this->logInfo('Preview', 'Streaming content of '.$file);
}

$length = floatval($offsets[1]) - $offset;
$length = floatval($offsets[1]) - $offset + 1;

if (!$length) $length = $filesize - $offset;
if ($length + $offset > $filesize || $length < 0) $length = $filesize - $offset;
header('HTTP/1.1 206 Partial Content');
Expand All @@ -98,7 +99,12 @@ public function switchAction($action, $httpVars, $filesVars)
while(ob_get_level()) ob_end_flush();
$readSize = 0.0;
while (!feof($file) && $readSize < $length && connection_status() == 0) {
echo fread($file, 2048);
if ($length < 2048){
echo fread($file, $length);
} else {
echo fread($file, 2048);
}

$readSize += 2048.0;
flush();
}
Expand Down

0 comments on commit 2055608

Please sign in to comment.