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:
+24
-1
@@ -23,7 +23,7 @@ const managerVite = spawn('npx', ['vite', '--port', String(MPORT), '--strictPort
|
||||
const waiterVite = await startViteNative({ port: 5191, backendUrl: backend.url })
|
||||
const WAITER = 'http://localhost:5191'
|
||||
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
|
||||
const r = reporter('media: Media page (batch upload, details), product photos (library + on the spot), waiter offline photos (5.2)')
|
||||
const r = reporter('media: Media page (batch upload, details), product photos (library + on the spot), waiter offline photos (5.2), video versions (5.4e)')
|
||||
const errors = []
|
||||
let failures = 0
|
||||
|
||||
@@ -110,6 +110,29 @@ try {
|
||||
await page.screenshot({ path: path.join(OUT, 'media-details.png') })
|
||||
await page.keyboard.press('Escape')
|
||||
|
||||
// 5.4e: a phone video gets its still frame and a version every screen plays, in the background
|
||||
const ff = execFileSync(PYTHON, ['-c', 'import imageio_ffmpeg as i; print(i.get_ffmpeg_exe())']).toString().trim()
|
||||
const mov = path.join(OUT, 'IMG_0042.MOV')
|
||||
execFileSync(ff, ['-hide_banner', '-loglevel', 'error', '-y', '-f', 'lavfi', '-i', 'testsrc2=s=2560x1440:r=25:d=3', '-f', 'lavfi', '-i', 'sine=d=3',
|
||||
'-c:v', 'libx265', '-x265-params', 'log-level=error', '-tag:v', 'hvc1', '-c:a', 'aac', '-shortest', mov])
|
||||
await page.getByTestId('media-file-input').setInputFiles(mov)
|
||||
const vidItem = page.locator('[data-testid="media-item"][data-name="IMG_0042"]')
|
||||
r.check('5.4e: a phone video (HEVC .MOV, 2560 × 1440) goes into the library', await vidItem.waitFor({ timeout: 30_000 }).then(() => true).catch(() => false))
|
||||
r.check('5.4e: …and its still frame shows in the grid by itself once the server made it (no reload)',
|
||||
await vidItem.locator('img').waitFor({ timeout: 60_000 }).then(() => true).catch(() => false))
|
||||
await vidItem.click()
|
||||
const vstatus = page.getByTestId('media-video-status')
|
||||
r.check('5.4e: details: "a version for every screen is ready", with its size listed',
|
||||
await waitFor(async () => ((await vstatus.getAttribute('data-state').catch(() => null)) === 'ready' ? true : null), 60_000, 500)
|
||||
&& await page.getByTestId('media-sizes').locator('li').count() === 5)
|
||||
const vid = (await api('GET', '/api/media?kind=video', { token: boss })).items.find(i => i.name === 'IMG_0042')
|
||||
const play = await fetch(backend.url + vid.urls.play, { headers: { range: 'bytes=0-15' } })
|
||||
r.check('5.4e: the version plays as MP4 (seekable); the original MOV is kept as uploaded',
|
||||
play.status === 206 && play.headers.get('content-type') === 'video/mp4' && vid.content_type === 'video/quicktime'
|
||||
&& vid.bytes === statSync(mov).size, `${play.status} ${play.headers.get('content-type')}`)
|
||||
await page.screenshot({ path: path.join(OUT, 'media-video.png') })
|
||||
await page.keyboard.press('Escape')
|
||||
|
||||
// ── A product's photo from the library, another one uploaded on the spot ────
|
||||
const products = await api('GET', '/api/products/?sold_at=in_store,in_store_takeaway', { token: boss })
|
||||
const [p1, p2] = products.filter(p => !p.is_service_item && p.lifecycle_status === 'active')
|
||||
|
||||
Reference in New Issue
Block a user