Chrome HTML5 video with mp4 / webm downloaded via php fpassthru (): cannot set currentTime?

So, this is a strange problem that I am facing. I tested only Chrome and Safari, both on the Mac and between these browsers, the problem only appears in Chrome.

I have a very simple HTML5 video element that downloads videos from my server, and the user has several buttons on the screen to go to a specific time in the video.

When a video file is referenced as a direct link, for example:

<video id="thevideo" width="720" height="480">
  <source type="video/webm" src="videos/vid102.webm" />
  <source type="video/mp4" src="videos/vid102.mp4" />
  <p>Your browser does not support this video.</p>
</video>

... it works great.

However, I just installed it to download the video via PHP fpassthru instead, for example:

<video id="thevideo" width="720" height="480">
  <source type="video/webm" src="getvideo.php?t=webm&v=166" />
  <source type="video/mp4" src="getvideo.php?t=mp4&v=166" />
  <p>Your browser does not support this video.</p>
</video>

where getvideo.phpit looks something like this:

<?php
$videoID = $_REQUEST["v"];
$videoType = $_REQUEST["t"];
$vidPath = "videos/video$vidFile.$videoType";

$fp = fopen($vidPath, 'rb');
header("Content-Type: video/$videoType");
header("Content-Length: " . filesize($vidPath));
fpassthru($fp);

?>

: . Chrome fpassthru PHP script currentTime , , - . document.getElementById('thevideo').currentTime = 50, , 50 , , .

, ?

UPDATE: , - Chrome, "Accept-Ranges" . "Accept-Ranges: bytes" .php script, , - , .

+3
1

, "Accept-Ranges", HTTP Byte Serving. :

Chrome

. "206 Partial Content" . , . fpassthru , , .

+4

All Articles