0

I have 2 different servers running Apache and while MP4 plays ok on one server it does not play on the other server. The code used is...

<video width='560' height='320' controls='' oncontextmenu='return false;' poster="big_buck_bunny.jpg" playsinline>
    <source src='https://example.com/big_buck_bunny.mp4' type='video/mp4'>
</video>

The html is identical on both pages. Apache directives and .htaccess files are identical. Mimetypes are identical. The only difference that I can find is that one server is CentOS 8.4 (works ok) and the other server is CentOS 7.9 (not working).

When I click the play button nothing happens, no error messages, nothing.

Both test pages play html5 video on all other devices, ie: Windows, Mac and Android. But on iPhone only one of our Apache servers play it. The same html and resource plays from Windows Server 2019 in iPhone no problem.

Changing video type is not an option and should not be necessary as most servers can play this MP4 embedded on a page as html5. Unfortunately the server that doesn't play for iPhone is our main production server, so I need to get that working somehow.

In response to suggestions that it may be due to byte-range, I did run a test and got this result...

curl -i -X HEAD --header "Range: bytes=50-100" https://example.com/big_buck_bunny.mp4
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 5381k 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 5381k 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
0 5381k 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
0 5381k 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
0 5381k 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
0 5381k 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
curl: (18) transfer closed with 5510872 bytes remaining to read
HTTP/1.1 200 OK
Date: Mon, 18 Oct 2021 21:58:50 GMT
Server: Apache
Last-Modified: Mon, 18 Oct 2021 00:02:20 GMT
ETag: "5416d8-5ce95423c3038"
Accept-Ranges: bytes
Content-Length: 5510872
Content-Type: video/mp4

This suggests that byte-range is not the problem, right? It is only iPhone that fails to play this video. Windows, Mac OSX and Android browsers work ok.

Kendo
  • 149
  • 9
  • I and 3 other developers, two of them server specialists, could not find anything preventing what should be allowed by default.. . byte-range requests. – Kendo Nov 03 '21 at 03:00

1 Answers1

0

This sounds like it might be caused by a server not being configured to handle byte range requests properly - safari is sensitive to this.

You can check if your server is handling them the way safari expects

If you are not sure whether your media server supports byte-range requests, you can open the Terminal application in OS X and use the curl command-line tool to download a short segment from a file on the server:

curl --range 0-99 http://example.com/test.mov -o /dev/null

If the tool reports that it downloaded 100 bytes, the media server correctly handled the byte-range request. If it downloads the entire file, you may need to update the media server. For more information on curl, see OS X Man Pages.

(from: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW6)

You can see some example outputs from the console in this answer: https://stackoverflow.com/a/32998689/334402

Mick
  • 24,231
  • 1
  • 54
  • 120
  • I did test byte-range and have now included those results in the question above. – Kendo Oct 18 '21 at 22:25
  • Can you share a link to the video that does not play? – Mick Oct 19 '21 at 06:50
  • As you can see above, my byte-range test failed. So I do need to add something to https.conf, even if only for the site in question. Mod-headers is already enabled, but what exactly to add and where? All other posts about this are too vague. Can I add it to .htaccess for that site only? – Kendo Oct 20 '21 at 02:35
  • What do I need to add to either httpd.conf or .htaccess to fix this? Please be specific as everything that I have found on this topic is vague. – Kendo Oct 22 '21 at 02:47
  • @Kendo - I think you mean, what do you have to do to ensure range requests work properly? I suggest you create a separate question on this and include the details of your server and current configuration. You may find the question would be better on a Superuser stackexchnage also. – Mick Oct 22 '21 at 08:36
  • Server details were already mentioned. – Kendo Oct 23 '21 at 20:25