feat(media): video versions: still frame + a version every screen plays (platform-v2 5.4e)

- services/video.py: background worker (one video at a time, low priority) makes a still
  frame (thumb/card/full WebP) and, when needed, play.mp4 (H.264+AAC, <=1920 px, HDR
  tone-mapped, faststart); the original is kept. Media.processing/progress (migration 0031,
  existing videos queued). ffmpeg from the pinned imageio-ffmpeg wheel; none = as uploaded.
- MOV (video/quicktime) accepted; /api/media/file/<sha>/play served with ranges.
- Signage plays the version (poster = still frame) and tells the screens playing it when ready.
- Manager library: still frames in the grid, preparing progress, status in the details.
- Tests: test_video.py (8), backend 541 passed; e2e media/signage/stack new checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 02:10:22 +02:00
co-authored by Claude Opus 5.5
parent f8d0d29d8f
commit b5361e10ca
28 changed files with 756 additions and 39 deletions
+17 -1
View File
@@ -100,6 +100,8 @@ try {
// ── the TV ────────────────────────────────────────────────────────────────
const tv = await (await browser.newContext({ viewport: { width: 1280, height: 720 } })).newPage()
tv.on('pageerror', e => errors.push(e.message))
const fetched = []
tv.on('request', q => fetched.push(q.url()))
await tv.goto(term.url)
await shown(tv, 'pairing-code', 20_000)
const code = await tv.getByTestId('pairing-code').getAttribute('data-code')
@@ -123,6 +125,18 @@ try {
r.check('the menu board lists the products with prices', await tv.getByTestId('signage-menu-item').count() > 0 && await tv.getByTestId('signage-menu-price').count() > 0)
await tv.screenshot({ path: path.join(OUT, 'signage-menu.png') })
// ── 5.4e: the server makes the video's version for screens; the TV switches to it by itself ──
const ready = await waitFor(async () => {
const m = await api('GET', `/api/media/${video.id}`, { token: boss })
return m.processing === 'done' || m.processing === 'failed' ? m : null
}, 90_000, 1000)
r.check('5.4e: the WebM video gets a still frame and a version every screen plays (H.264 MP4)', !!ready?.urls?.play && !!ready?.urls?.full,
JSON.stringify(ready && { processing: ready.processing, urls: Object.keys(ready.urls) }))
r.check('5.4e: …the TV is told and fetches that version without a reload',
!!(await waitFor(async () => (fetched.some(u => u.endsWith(`${video.sha256}/play`)) ? true : null), 20_000, 300)))
const poster = await waitFor(async () => ((await kindNow(tv)) === 'video' ? tv.getByTestId('signage-video').getAttribute('poster') : null), 30_000, 200)
r.check('5.4e: …and plays it with its still frame behind it while it loads', !!poster, String(poster))
// ── a TV mounted sideways ─────────────────────────────────────────────────
await api('PUT', `/api/signage/screens/${dev.id}`, { token: boss, body: { rotation: 90 } })
r.check('turn the picture 90°: the frame turns', await waitFor(async () => (await tv.getByTestId('signage-frame').getAttribute('data-rotation')) === '90', 15_000, 300))
@@ -280,7 +294,9 @@ try {
// ── 5.6c: screens, schedules, the message of the day ─────────────────────
await api('PUT', `/api/signage/screens/${dev.id}`, { token: boss, body: { playlist_id: pl.id } })
await mgr.getByTestId('signage-tab-settings').click()
await mgr.getByTestId('signage-weather').waitFor({ timeout: 10_000 }) // loaded: the message field holds the saved text
await mgr.getByTestId('signage-weather').waitFor({ timeout: 10_000 })
const savedMessage = (await api('GET', '/api/signage/message', { token: boss })).text || ''
await waitFor(async () => ((await mgr.getByTestId('signage-message').inputValue()) === savedMessage ? true : null), 10_000, 200) // loaded
await mgr.getByTestId('signage-message').fill('Kalimera from the manager')
await mgr.getByTestId('signage-message-save').click()
await sleep(700)