diff --git a/src/components/blog/Attachments.svelte b/src/components/blog/Attachments.svelte index 41613ae..418abe4 100644 --- a/src/components/blog/Attachments.svelte +++ b/src/components/blog/Attachments.svelte @@ -24,6 +24,17 @@ function toggle(id: string): void { revealed = { ...revealed, [id]: !revealed[id] } } + + /** + * Ask the browser to decode the first real frame while it loads metadata. + * The tiny media-fragment seek also makes the video's intrinsic dimensions + * available before playback on browsers that otherwise leave it at 300×150. + */ + function videoPreviewUrl(url: string): string { + const fragment = url.indexOf('#') + const base = fragment >= 0 ? url.slice(0, fragment) : url + return `${base}#t=0.001` + } {#if attachments.length > 0} @@ -39,12 +50,12 @@ {#if media.type === 'video' || media.type === 'gifv'}