I am facing the issue that my some resources (in this case videos) seem to not get loaded on mobile devices. Locally and on desktop everything is working fine. Did anybody experience something like this before? The weird thing is that others get loaded perfectly fine even on mobile devices.
The URL in the source code leads to the right videos though and video format should not be an issue as well since it is mp4 I am using for now. So could there be any reason why some ressources could not be accessed on a mobile device?
It seems to depend on the browser since it is not working in safari on desktop either. Only the first mobile_mp4() gets loaded. The desktop_webm(), desktop_mp4(), full() fields do not get loaded and are marked red in the network tab. Please help, I am really frustrated.
No experience with video, but if you google the issue, like I just did, you can find for example this: html - Safari doesn't play .mp4 videos - Stack Overflow
Apart from that, I don’t really understand why you load so many videos, what is the condition here for mobile/full/desktop, looks as if you load them all.
Also, you are missing if statements that make sure that the file exist before calling the url()
method. This code will fail, if you happen to remove the files, see docs how to do this properly: Files | Kirby CMS
Thanks for your reply!
Unfortunately the file format is not the issue since the same video file is working in one field and not the other. Furthermore if I replace the mobile_mp4() field whose video files are loading perfectly fine with the full() field it is not working again.
<?php dump ($full); ?> gives me this: <?php dump ($video); ?> gives me this:I do not load so many videos since they have a data-src attribute until javascript handles the loading of a video with setting it to src attribute.
If statements is a good point. I will include them.
This is not really a Kirby issue.
But what is the difference between the mp4 video files stored in the mobile_mp4
, full
and desktop_mp4()` fields? If they are the same, why have three fields and 3 video tags?
There is one short video teaser in landscape format and one in portrait format and the video in full length that can be watched on demand.
I solved the problem though. You were right and it was a codec issue of the mp4 format after all. Thanks for your advice!