Meridian handbook
Content modellingFields

Video

The video field: a YouTube or Vimeo video, a media library video or an .mp4/.webm file on an allowed host, with poster, captions confirmation, title and transcript, rendered through a privacy facade.

A video field references one video. It never embeds a third party’s player on page load: the template renders a facade, the poster and a play button naming the video, and loads the player only when the visitor activates it, from YouTube’s no-cookie domain or with Vimeo’s do-not-track flag.

fields:
  - name: film
    type: video
    sources: [youtube, vimeo]
    poster: required
    captions: required
    transcript: true

  - name: backgroundLoop
    type: video
    sources: [file]
    hosts: [media.example.org, self]
    poster: required
    captions: none

Parameters

ParameterTypeDefaultWhat it does
sourceslist of youtube, vimeo, library, file[youtube, vimeo]What may be chosen. library is a video reference from the media library; file is an .mp4 or .webm on an allowed host.
hostslist of host namesnoneRequired with file: the hosts a file may come from. self allows a path to one of the project’s own public files, such as /video/harbour.mp4.
posterrequired or optionaloptionalThe still shown before playing: a library image, else the provider’s thumbnail, which the server fetches once and keeps in the library. required makes publishing need one.
captionsrequired, warn or nonewarnWhether publishing asks the editor to confirm the video has captions: required refuses without the confirmation, warn publishes with a warning, none does not ask.
transcriptbooleanfalseOffers a transcript, rich text per locale.
structureshared or per_localesharedper_locale makes the whole video each locale’s own (a different film per language).

engine-dmo check refuses an unknown source, file without hosts, hosts without file, and values outside the lists above.

Validation

CodeMessage
video_choosePaste a video’s address or choose one from the library
video_urlPaste the address of a youtube, vimeo video
video_sourceThis field does not take vimeo videos
video_id_youtube, video_id_vimeoThis is not a YouTube / Vimeo video’s address
video_fileA video file’s address starts with https://
video_hostVideo files may only come from media.example.org
video_file_typeA video file is an .mp4 or a .webm
video_libraryChoose a video from the library
video_titleEnter the video’s title; it names the player for screen readers (in the source locale)
video_startThe start is a number of seconds from the beginning
video_durationWrite the duration as minutes and seconds, such as 3:33
video_poster, video_poster_chooseChoose a poster image for the video (at publish, with poster: required)
video_captionsConfirm the video has captions before publishing (captions: required)
video_captions_unconfirmedWarning: the video is not confirmed as captioned (captions: warn)
transcript_offeredThis field does not take a transcript

Stored value

{
  "source": "youtube", "id": "aqz-KE-bpKQ", "start": 30,
  "title": "A walk along the harbour wall",
  "poster": { "asset": "3c1e..." },
  "captions": true,
  "duration": "PT3M33S",
  "transcript": [ { "_type": "block", "_key": "t1", "children": [ { "_type": "span", "text": "..." } ] } ]
}

A Vimeo video may carry hash (an unlisted video’s), a file source has url instead of id, and a library source has asset. The editor pastes a watch page’s address and the engine reads the id from it. title and transcript are each locale’s own; everything else is shared by every locale. With index: true the poster and library asset ids are projected.

Template value

Printing the value prints the watch page’s URL.

PropertyWhat it is
titleThe video’s title, the player’s accessible name.
source, idyoutube, vimeo, library or file, and the provider’s id.
start, durationWhere playing starts in seconds, and the length as ISO 8601.
captionsWhether the editor confirmed captions.
watchUrl, embedUrlThe provider’s page, and the player on its privacy domain.
posterThe poster as an image value, with img, picture, figure, transform and url.
transcriptThe transcript as Portable Text.
MethodWhat it writes
render(transform=, sizes=, priority=, element=)The facade: the poster and a play button naming the video, loading nothing from the provider until activated. element is figure (the default) or div. Other keywords are the wrapper’s attributes.
background(transform=)A muted, looping, inline file video for decoration, with a pause button. Refused without a poster, and never plays under reduced motion or Save-Data.
link(text=)A plain link to the watch page, for a list or an email.
{% if entry.film %}
  {{ entry.film.render(transform="hero") }}
  {% if entry.film.transcript %}<details><summary>Transcript</summary>{{ entry.film.transcript|ptext }}</details>{% endif %}
{% endif %}

For a video that is not a field (a provider link pasted in rich text or a template’s own embed), see embed() in Globals.