Paint a first frame in clip previews: '#t=0.1' media fragments

With preload="metadata" browsers paint NOTHING until playback, so the Video
tab's hero monitor and every filmstrip thumbnail sat black — clips looked
missing while their audio played fine ('no picture, but sound'). The media
fragment makes the browser seek and paint the frame at 0.1 s without playing.
Verified in-browser: fresh load paints hero + all thumbnails; selecting a
scene paints its first frame immediately.

(cherry picked from commit a81280b1543b9f6aa913be8373f0a390d3db5871)
This commit is contained in:
Justo Stoll
2026-08-26 21:24:57 +02:00
parent fb7c2204d4
commit 8bc3659bf2
2 changed files with 5 additions and 2 deletions
@@ -38,7 +38,10 @@
}: Props = $props();
let errorOpen = $state(false);
const previewUrl = $derived(previewPath ? assetUrl(previewPath) : null);
// '#t=0.1' media fragment: with preload="metadata" browsers paint NOTHING
// until playback, so every clip preview sat black ("no picture, but sound").
// The fragment makes the browser seek+paint a first frame without playing.
const previewUrl = $derived(previewPath ? assetUrl(previewPath) + '#t=0.1' : null);
$effect(() => {
void previewPath;
@@ -81,7 +81,7 @@
<img class="thumb-media" src={thumb.src} alt="" loading="lazy" />
{:else if thumb?.kind === 'video'}
<!-- svelte-ignore a11y_media_has_caption -->
<video class="thumb-media" src={thumb.src} muted playsinline preload="metadata"></video>
<video class="thumb-media" src={thumb.src + '#t=0.1'} muted playsinline preload="metadata"></video>
{:else}
<span class="thumb-slate">#{scene.order_index}</span>
{/if}