projects

saturn

My website

fix: add thumbnail support to media

daniel daum committed parent ad0c3ca commit 845c32fSigned, not verified

SignedGitea couldn't verify the signature.

Showing 1 changed file with 6 additions and 1 deletion.

functions/_middleware.js +6 −1
@@ -276,11 +276,16 @@ function renderActivityItem(posts) {276276// Not autoplayed and not muted: it is a post attachment, the visitor presses277277// play. `playsinline` keeps iOS from taking over the screen on tap. The link278278// inside is what a browser without <video> support gets.279//280// There is no poster: the record carries no thumbnail. Safari will not paint281// a frame of a poster-less video on preload="metadata", it leaves the box282// blank, so the src carries a media fragment just past zero, which makes it283// seek and paint the first frame. Chrome and Firefox paint it either way.279284function renderVideo(video) {280285    const src = mediaUrl(video.cid);281286    const size = video.width && video.height ? ` width="${video.width}" height="${video.height}"` : "";282287    const label = video.alt ? ` aria-label="${escapeHtml(video.alt)}"` : "";283    return `<video class="micro-video" src="${src}"${size}${label} controls playsinline preload="metadata"><a href="${src}">VIDEO</a></video>`;288    return `<video class="micro-video" src="${src}#t=0.001"${size}${label} controls playsinline preload="metadata"><a href="${src}">VIDEO</a></video>`;284289}285290286291function blobUrl(cid) {