FileMedia: Local videos has no thumbnail on iOS

Created on 5 September 2019, about 5 years ago
Updated 15 July 2024, 4 months ago

The FileVideoFormatter in core does not provide any thumbnail by default with local video uploads.

Luckily (?), most browsers like Chrome are smart enough to supply the first frame of the video as the thumbnail, but this is not something iOS Safari does.

The generated HTML for the current fieldformatter looks something like this:

<div class="field field--name-field-media-video-file field--type-file field--label-hidden field__item">
  <video controls="controls" width="1024" height="576">
      <source src="/sites/default/files/2019-05/somevideo.mp4" type="video/mp4">
  </video>
</div>

I found out that by adding preload="metadata" to the video tag and suffixing "#t=1" to the source files "src" attribute, it adds the wanted behavior to Safari iOS.

I've created a patch for adding this functionality. After adding the patch, video fields will look something like this:

<div class="field field--name-field-media-video-file field--type-file field--label-hidden field__item">
  <video controls="controls" width="1024" height="576" preload="metadata">
      <source src="/sites/default/files/2019-05/somevideo.mp4#t=1" type="video/mp4">
  </video>
</div>
๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
File systemย  โ†’

Last updated about 12 hours ago

Created by

๐Ÿ‡ฉ๐Ÿ‡ฐDenmark ras-ben Copenhagen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024