Add poster field to video artwork blueprints

This commit is contained in:
Paul Nicoué 2022-06-03 17:35:16 +02:00
parent c0e9465298
commit f4d9653fe6
3 changed files with 30 additions and 6 deletions

View file

@ -9,6 +9,24 @@ fields:
en: Alternative text
fr: Texte alternatif
type: text
poster:
when:
file_type: video
label:
en: Poster
fr: Vignette
type: files
uploads: image
layout: cards
image:
ratio: 16/9
cover: true
back: white
multiple: false
help:
en: "Image displayed before video playback (format: JPEG or PNG). The first image of the video is used if this field is empty."
fr: "Image affichée avant la lecture de la vidéo (format : JPEG ou PNG). La première image de la vidéo est utilisée si ce champ est vide."
width: 1/4
caption:
label:
en: Caption

View file

@ -20,9 +20,15 @@
{% for artwork in artworks %}
<figure class="gallery__artwork">
{% if artwork.type == 'video' %}
<video class="gallery__video" controls playsinline preload="metadata">
<source src="{{ artwork.url }}" type="video/mp4" />
</video>
{% if artwork.poster is not empty %}
<video class="gallery__video" data-poster="{{ artwork.poster.toFile.url }}" preload="metadata" controls playsinline>
<source src="{{ artwork.url }}" type="video/mp4"/>
</video>
{% else %}
<video class="gallery__video" preload="metadata" controls playsinline>
<source src="{{ artwork.url }}" type="video/mp4"/>
</video>
{% endif %}
{% endif %}
{% if artwork.type == 'image' %}
<img class="gallery__image" src="{{ artwork.url }}" srcset="{{ artwork.srcset() }}" alt="{{ artwork.alt_text }}">

View file

@ -13,9 +13,9 @@
<nav class="home__nav" aria-label="Menu">
{% set navItemNo = 1 %}
{% for gallery in pages.template('gallery') %}
<div class="home__nav-item-{{ navItemNo }}">
<a href="{{ gallery.url }}" target="_self" class="home__nav-link">{{ gallery.title }}</a>
</div>
<div class="home__nav-item-{{ navItemNo }}">
<a href="{{ gallery.url }}" target="_self" class="home__nav-link">{{ gallery.title }}</a>
</div>
{% set navItemNo = navItemNo + 1 %}
{% endfor %}
<div class="home__nav-image" aria-hidden="true">