Add a captioned video
Put a video from the media library on a page so everyone can use it: native controls that work with a keyboard and a screen reader, captions on from the start, a transcript under it, and structured data for video search results.
Before you start: an author (media.upload and content editing). The video as an MP4 or WebM file under 25 MB, a poster image (a still from the video works), and its captions as a WebVTT file (.vtt, starting with WEBVTT). Most captioning tools export WebVTT; convert an .srt file before uploading it.
Steps
- Content → Media → Upload files. Upload the video, the poster and the captions file. Open the video's details: the library read its length and whether it has sound. A
.vttfile that does not start withWEBVTTis refused, since browsers would ignore it. - Open the page in the page builder and drag Video (Content) onto it.
- Video file: Choose file and pick the video. Poster image: Choose image and pick the poster.
- Title: what the video is ("How to publish a page"). Screen readers name the player by it and search engines show it. Description: one sentence; it shows under the video.
- Captions → Add item: Choose file and pick the
.vttfile, set Language (en,es,fr-CA) and Label (English), and leave Shown by default on. Add a track per language; one is the default. - Transcript: paste or write the words of the video, with headings for its parts if it is long. It shows in an expandable Transcript section under the player and is found by site search.
- Leave Load before play at Nothing (saves data), and leave Start muted and Play on its own off, unless the video is silent decoration.
- Run Checks, then publish.
Check the result
- Checks shows no video warning. It warns when a video with sound has neither captions nor a transcript, when the poster or the title is missing, and when Play on its own is on for a video that does not start muted.
- On the page, the player shows the poster and nothing loads until you press play. Press Tab until the player has focus: Space plays and pauses, and the captions show from the start; the player's captions button turns them off.
- Seeking works in every browser, Safari included: the server answers the player's byte range requests (
206 Partial Content). - Transcript opens under the player.
- The page's source has a
<script type="application/ld+json">with"@type":"VideoObject", the title, the poster, the upload date, the length ("duration":"PT2M5S") and the captions file. Google's Rich Results Test reads it from the published URL.
Going further
Spillway 0.1.24