Add a featured video mode to the front page hero

A fourth hero mode beside brand, photos and livestream: a recorded
video next to the words, under a "Featured video · <title>" badge.
Unlike the livestream it never autoplays: an embed waits for play,
and a file shows the browser's own player with preload="metadata".

video_url takes a YouTube, Vimeo or Facebook link (turned into an
embed, as the livestream's is) or a video file: a filename in
public/front-page/, a /path, or an https URL ending in .mp4, .webm,
.m4v, .mov or .ogv. Anything else that can't be framed still gets a
"Watch the video" button. Files follow the embeds' https-only rule.

Its own video_url and video_title columns rather than the
livestream's, so both can be set up ahead of time and the mode
switches between them. Migration 024 rebuilds front_page for the
wider hero_mode CHECK; its children, keys and touch trigger survive.

embeds.ts gains an autoplay switch shared by both modes, and
videoSource() to tell a file from an embed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zaldimmar 2026-09-26 17:55:51 -05:00
parent b10a263a90
commit 8c26ec4906
8 changed files with 243 additions and 22 deletions

View file

@ -950,8 +950,9 @@ const timeline = {
One record (see the singleton note in server/src/admin-schema.js).
The groups are the hero; the collections below are the rest of
the page. Photos and the livestream are editable whatever the
mode, so either can be ready before the switch is flipped.
the page. Photos, the livestream and the featured video are
editable whatever the mode, so each can be ready before the
switch is flipped.
Section keys and stat sources are the CHECK lists on
front_page_sections and front_page_stats. The labels here are what the admin reads; the values are
@ -1000,6 +1001,7 @@ const frontPage = {
["brand", "Brand — animated colour, no media"],
["photos", "Photos — cycles through the photos below"],
["livestream", "Livestream — embeds the stream with a LIVE badge"],
["video", "Featured video — shows the video below, click to play"],
],
blankLabel: "— brand —",
help: "Switch to Livestream when you go live, and back when you're done",
@ -1014,7 +1016,7 @@ const frontPage = {
],
},
{
legend: "Photos and livestream",
legend: "Photos, livestream and video",
fields: [
{
path: "slide_seconds",
@ -1029,6 +1031,15 @@ const frontPage = {
help: "A YouTube, Facebook or Vimeo link, or any embed URL",
},
{ path: "livestream_title", label: "Livestream title", full: true },
{
path: "video_url",
label: "Featured video",
full: true,
help:
"A YouTube, Vimeo or Facebook link, or a video file: a filename in " +
"public/front-page/ or a link ending in .mp4 or .webm",
},
{ path: "video_title", label: "Video title", full: true, help: "Shown after \"Featured video\" above the headline" },
],
},
{