Can't access video file stored in "media" on Safari

Hey there,

After updating to Kirby 3, I have a weird bug which I can’t solve. I also browsed the other related topics, but it didn’t get me to a solution.

In some of my templates I load .mp4 video files in an html5 video element.
This works fine in every browser except Safari.

Mime types are specified, the video tag seems to be fine, the problem really seems to be in the request on the media folder.

What I tested already:

  • The video file exists in the requested path (works fine when directly accessing it in another browser)
  • When opening the video directly from the media path in Safari, the video can’t be loaded (Safari)
  • If I open the video file in the panel in Safari, the video file can’t be loaded as well
  • If I open the video on Safari directly from the content path, the video loads and plays correct

I’m super happy about help, don’t know what to test more…

Best, Marco

Which version of Safari? Do you use any browser plugins? If so, try disabling them.

Version 13.0.5 (15608.5.11)
No plugins installed

Hm, I can only test with an older version of Safari (12.0.3) and accessing a video file from the media folder works with this version :thinking:

Can you eventually test it here? It’s the video in the section “Der neue Weg…”

And the video file directly would be this one:
https://www.start-pulse.com/media/pages/warum-pulse/methode/4243503647-1583220636/new-survey.mp4

No, those files don’t work in my Safari either.

I get an error message in console: “Failed to load resource. Plug-in handled load”

I assume that the original file itself from the content folder will work for you?
http://start-pulse.com/content/start-pulse.com/1_warum-pulse/1_methode/new-survey.mp4

Yes, that one works.

Hmm, so does the file then get corrupted when it’s created in the media folder?

Then it wouldn’t work in other browsers. The strange thing is that the file first sends a HTTP 200 response before it then fails.

Does it possibly have to do with the byte-range requests?
When I try the curl command in there, it downloads the full file if I understood it correct. But then again it’s super weird, that it used to work in Kirby 2 or if you download the file directly from content folder.

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

Does it work locally for you?

no, the problem is as well locally on a MAMP server.

anyone else has an idea?

Response for content and media folders isn’t the same: possibly due to .htaccess or server config;

Media response:

Alt-Svc: quic=":443"; ma=2592000; v="39,43,46,50", h3-Q039=":443"; ma=2592000, h3-Q043=":443"; ma=2592000, h3-Q046=":443"; ma=2592000, h3-Q050=":443"; ma=2592000, h3-23=":443"; ma=2592000, h3-24=":443"; ma=2592000
Connection: Keep-Alive
Content-Type: video/mp4; charset=UTF-8
Date: Tue, 03 Mar 2020 17:59:01 GMT
Transfer-Encoding: chunked

Content response:

Accept-Ranges: bytes
Alt-Svc: quic=":443"; ma=2592000; v="39,43,46,50", h3-Q039=":443"; ma=2592000, h3-Q043=":443"; ma=2592000, h3-Q046=":443"; ma=2592000, h3-Q050=":443"; ma=2592000, h3-23=":443"; ma=2592000, h3-24=":443"; ma=2592000
Connection: Keep-Alive
Content-Length: 7349584
Content-Type: video/mp4
Date: Tue, 03 Mar 2020 17:59:11 GMT
Etag: "702550-5e5e079c-bfdbbabbcbb01bf2;;;"
Last-Modified: Tue, 03 Mar 2020 07:30:36 GMT

You can see that the server sends different headers, so I’d look into server setup. Probably .htaccess

I don’t see how request on the media folder would be handled differently unless you have some non-standard server configs. Manually copy the file to the media folder just to make sure maybe? If the problem is indeed the thumb method crippling the .mp4, I’d file a bug report.

Hey, @phm thanks for looking into this. But the thing is that the file is available in other browsers, so I don’t think it gets crippled. Also, from other browsers you can download the file like I did. The problem is really the response, and I think in particular this missing Accept-ranges: bytes bit.

I don’t see why the thumb method should do something with the file?

Win 7/ Firefox 72
same error for the 2 links :

La ressource multimédia https://www.start-pulse.com/media/pages/warum-pulse/methode/4243503647-1583220636/new-survey.mp4 n’a pas pu être décodée, erreur : Error Code: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005)
Details: mozilla::MediaResult __cdecl mozilla::WMFVideoMFTManager::ValidateVideoInfo(void): Can’t decode H.264 stream because its resolution is out of the maximum limitation

@marco I don’t think it’s something Kirby related.
Quick test here: https://manuelmoreale.dev/plainkit-master/
The file is loaded from the media folder and it’s loading just fine for me in safari.

This is latest Kirby on a DO distro.

@marco So after some digging looks like that’s most likely the issue. There’s quite a few issues online going back years but usually the problem is the server lacking byte-range support.

Your case is quite weird though because it’s only the video served from the media folder that is creating problems so must be something else that’s interfering.

Unfortunately my knowledge of server setups is quite limited so I have no idea where you could look to find out what’s causing this specific issue :man_shrugging:

That said, as a workaround, you could just use the original file in the content folder since that’s loaded just fine from what i can see. Obviously not a permanente solution but better than nothing.