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

Commit 2055608

Browse files
committed
Bug video reading issue with the http range
Should fix #954
1 parent 9222b39 commit 2055608

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/src/plugins/editor.video/class.VideoReader.php

100644100755
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ public function switchAction($action, $httpVars, $filesVars)
7575
$this->logInfo('Preview', 'Streaming content of '.$file);
7676
}
7777

78-
$length = floatval($offsets[1]) - $offset;
78+
$length = floatval($offsets[1]) - $offset + 1;
79+
7980
if (!$length) $length = $filesize - $offset;
8081
if ($length + $offset > $filesize || $length < 0) $length = $filesize - $offset;
8182
header('HTTP/1.1 206 Partial Content');
@@ -98,7 +99,12 @@ public function switchAction($action, $httpVars, $filesVars)
9899
while(ob_get_level()) ob_end_flush();
99100
$readSize = 0.0;
100101
while (!feof($file) && $readSize < $length && connection_status() == 0) {
101-
echo fread($file, 2048);
102+
if ($length < 2048){
103+
echo fread($file, $length);
104+
} else {
105+
echo fread($file, 2048);
106+
}
107+
102108
$readSize += 2048.0;
103109
flush();
104110
}

0 commit comments

Comments
 (0)