Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No way to preload first video frame on iOS Safari?

I have a simple HTML5 video embed that displays a blank (white) frame when loaded on iOS. On desktop browsers (including Safari) and Android the first frame of the video is displayed.

I understand that you can avoid this by setting an explicit poster image, but I'm hoping I can avoid having to set up a transcoding service to extract the first frame of the videos. I understand that Apple has probably chosen this route to limit the bandwidth use for mobile users, but in this instance it's just overkill to set up a transcoding service.

I've played around with the preload attribute, but neither setting it to auto or metadata works. Is there any other way to display the first frame of the video without interaction from the user?

Here is a link to a pen where I am illustrating the problem.

https://s.codepen.io/webconsult/debug/oRmQva/vWMRwadNoNvr

And here is a screenshot of how the code is rendered on iOS simulator (same on real hardware) and in Chrome respectively.

like image 752
zkwsk Avatar asked Dec 22 '25 09:12

zkwsk


2 Answers

You can use Media Fragments URI

Just Append #t=0.1 to the end of the video URL

like image 89
Sahil H. Mobidien Avatar answered Dec 24 '25 00:12

Sahil H. Mobidien


Try following code. This is work for me

<video src="video/video.mp4#t=0.5" playsinline controls preload="metadata">
      <source src="video/video.mp4#t=0.5" type="video/mp4">
</video>
like image 23
Jenish MS Avatar answered Dec 23 '25 22:12

Jenish MS



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!