Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294348

FileMedia: Local videos has no thumbnail on iOS

$
0
0

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>

Viewing all articles
Browse latest Browse all 294348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>