Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

BYTE_RANGE_ERROR_MESSAGE while streaming video via PHP

Hello.

I'm trying to (pseudo-/HTTP-)stream a video on the iPad and I'm getting this short message from the Safari browser on my iPad: "Quicktime: BYTE RANGE_ERRORMESSAGE".

This is the situation: I made a HTML5 page with an "video"-Tag in it to load/stream a Quicktime/mp4 video file:

<video width="720" height="576" controls autoplay>
<source src="video.mov" type="video/mp4" />
</video>

This works fine on my iPad. The problem is now: I can't write the videos source path directly in the HTML-tag because it should be hidden. So I write:

<video width="720" height="576" controls autoplay>
<source src="stream_video.php?videoID=4" type="video/mp4" />
</video>

The PHP file looks like this:
<?php

// send headers (not all necessary for iPad, some for other devices/browsers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Pragma: no-cache"); // IE
header("Cache-Control: no-cache"); // IE
header("Connection: Keep-Alive");
header("Content-Type: video/mpeg");
header("Content-Disposition: attachment; filename=video.mov;");
header("Content-Description: File Transfer");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize($sourceFile));

// output file
readfile($sourceFile);
exit();

?>

Now this PHP-script works fine for all browsers on computers but not, if the webpage with the embedded video should be shown on an iPad. The iPad Safari shows the broken video icon and the debug console says "Quicktime: BYTE RANGE_ERRORMESSAGE". That's all, no video.

Does anybody know a solution for this problem? I haven't found any description for this error message!? Are the headers I'm sending allright for the iPad?

TIA and best regards, Joe

iPad, iPad OS: 3.22

Posted on Sep 23, 2010 7:13 AM

Reply
7 replies

Sep 23, 2010 8:33 AM in response to Joe Rooster

Joe Rooster wrote:


The PHP file looks like this:
<?php

// send headers (not all necessary for iPad, some for other devices/browsers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Pragma: no-cache"); // IE
header("Cache-Control: no-cache"); // IE
header("Connection: Keep-Alive");
header("Content-Type: video/mpeg");
header("Content-Disposition: attachment; filename=video.mov;");
header("Content-Description: File Transfer");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize($sourceFile));

// output file
readfile($sourceFile);
exit();

?>

Now this PHP-script works fine for all browsers on computers but not, if the webpage with the embedded video should be shown on an iPad. The iPad Safari shows the broken video icon and the debug console says "Quicktime: BYTE RANGE_ERRORMESSAGE". That's all, no video.

Does anybody know a solution for this problem? I haven't found any description for this error message!? Are the headers I'm sending allright for the iPad?


I believe that the BYTE RANGE_ERRORMESSAGE indicates that the iPad requires that any audio/video input comes from a source which supports byte-range HTTP 1.1 headers (i.e, partial file requests, for example, "Range: bytes=500-999" requesting the second 500-bytes of a document). If the source doesn't actually support this it will fail. Your simple PHP file does not support partial requests although your header says that it does, "header("Accept-Ranges: bytes");".

Sep 23, 2010 9:45 AM in response to Joe Rooster

Joe Rooster wrote:
Hello.

I'm trying to (pseudo-/HTTP-)stream a video on the iPad and I'm getting this short message from the Safari browser on my iPad: "Quicktime: BYTE RANGE_ERRORMESSAGE".

This is the situation: I made a HTML5 page with an "video"-Tag in it to load/stream a Quicktime/mp4 video file:

<video width="720" height="576" controls autoplay>
<source src="video.mov" type="video/mp4" />
</video>

This works fine on my iPad. The problem is now: I can't write the videos source path directly in the HTML-tag because it should be hidden. So I write:

<video width="720" height="576" controls autoplay>
<source src="stream_video.php?videoID=4" type="video/mp4" />
</video>

The PHP file looks like this:
<?php

// send headers (not all necessary for iPad, some for other devices/browsers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Pragma: no-cache"); // IE
header("Cache-Control: no-cache"); // IE
header("Connection: Keep-Alive");
header("Content-Type: video/mpeg");
header("Content-Disposition: attachment; filename=video.mov;");
header("Content-Description: File Transfer");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize($sourceFile));

// output file
readfile($sourceFile);
exit();

?>

Now this PHP-script works fine for all browsers on computers but not, if the webpage with the embedded video should be shown on an iPad. The iPad Safari shows the broken video icon and the debug console says "Quicktime: BYTE RANGE_ERRORMESSAGE". That's all, no video.

Does anybody know a solution for this problem? I haven't found any description for this error message!? Are the headers I'm sending allright for the iPad?

TIA and best regards, Joe
Joe Rooster wrote:
Hello.

I'm trying to (pseudo-/HTTP-)stream a video on the iPad and I'm getting this short message from the Safari browser on my iPad: "Quicktime: BYTE RANGE_ERRORMESSAGE".

This is the situation: I made a HTML5 page with an "video"-Tag in it to load/stream a Quicktime/mp4 video file:

<video width="720" height="576" controls autoplay>
<source src="video.mov" type="video/mp4" />
</video>

This works fine on my iPad. The problem is now: I can't write the videos source path directly in the HTML-tag because it should be hidden. So I write:

<video width="720" height="576" controls autoplay>
<source src="stream_video.php?videoID=4" type="video/mp4" />
</video>

The PHP file looks like this:
<?php

// send headers (not all necessary for iPad, some for other devices/browsers
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Pragma: no-cache"); // IE
header("Cache-Control: no-cache"); // IE
header("Connection: Keep-Alive");
header("Content-Type: video/mpeg");
header("Content-Disposition: attachment; filename=video.mov;");
header("Content-Description: File Transfer");
header("Accept-Ranges: bytes");
header("Content-Length: ".filesize($sourceFile));

// output file
readfile($sourceFile);
exit();

?>

Now this PHP-script works fine for all browsers on computers but not, if the webpage with the embedded video should be shown on an iPad. The iPad Safari shows the broken video icon and the debug console says "Quicktime: BYTE RANGE_ERRORMESSAGE". That's all, no video.

Does anybody know a solution for this problem? I haven't found any description for this error message!? Are the headers I'm sending allright for the iPad?

TIA and best regards, Joe

Hi,

I'm also interested in knowing whether, for example, an apache handles the request differently than the script:

'Apache also uses a number of filters internally to perform functions like chunking and byte-range handling.' found on http://httpd.apache.org/docs/2.2/filter.html

Does this mean we have to reimplement this behaviour in PHP?
Are there solutions/scripts that do implement this?

Sep 24, 2010 2:18 AM in response to Joe Rooster

Joe Rooster wrote:
Hi,

I've tried a

header("Accept-Ranges: none");

too, but the result was the same: the video wasn't shown on the iPad.
Maybe there is a hint in this W3C RFC:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1

But my server knowledge is to weak to find a solution for the problem in the text.

Best regards, joe


While reading the RFC:

If you could sent a PHP-header with status-code 416 (Requested range not satisfiable) answering the BYTE RANGEREQUEST sent from the iPad, this COULD prevent the iPad from further requesting partial data.

Not knowing the behaviour of the native ios Quicktime player on this subject, the only way to found out is to implement the 416 status-code within the script.

Sep 24, 2010 4:39 AM in response to Frank Mathys

While doing some tests:

When I request the file directly through Apache,

I get several requests, one containing a Range

+GET /php_streamer/test.mp4 HTTP/1.1+
+Host: 10.0.2.1+
+Range: bytes=0-1+
+Connection: close+
+User-Agent: AppleCoreMedia/1.0.0.7B500 (iPad; U; CPU OS 3 22 like Mac OS X)+
+Accept: /+
+Accept-Encoding: identity+
+If-None-Match: "3f0ee3-4f977e-53a00d00"+
+If-Modified-Since: Thu, 26 Aug 2010 10:19:00 GMT+

Apache will answer with a

+HTTP/1.1 206 Partial Content+
+Date: Fri, 24 Sep 2010 10:52:42 GMT+
+Server: Apache/2.0.63 (Unix) PHP/5.2.13 DAV/2+
+Last-Modified: Thu, 26 Aug 2010 10:19:00 GMT+
+ETag: "3f0ee3-4f977e-53a00d00"+
+Accept-Ranges: bytes+
+Content-Length: 2+
+Content-Range: bytes 0-1/5216126+
+Connection: close+
+Content-Type: text/plain+

If you use the following PHP function getallheaders(), you will get the request header.
so, when parsing the header, you can determine which reply to send.

After this first partial request, the actual requests will be sent from the AppleCore to retrieve several chunked portions of the video.

BYTE_RANGE_ERROR_MESSAGE while streaming video via PHP

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.