Video stills skip YouTube's gray placeholder; timeline back to teal dots; people rows fill
- A still that fails or comes back as YouTube's 120 x 90 "no thumbnail" image gives way to the next; with none left the player is a flat teal panel with the play button showing. - Timeline: solid teal dots, a solid teal rail and teal decade tags (still on their branch), one color throughout, until a vine or tree drawing replaces them. The leaf colors are gone. - People tiles fill each row with as many as fit (2 to 10), one fewer only when the last row would be a single tile, instead of evening rows out (8 where 6 fit had come out 4 and 4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6506f65b1e
commit
57f8020542
11 changed files with 98 additions and 151 deletions
|
|
@ -127,15 +127,18 @@ export function playingSource(source: VideoSource): VideoSource {
|
|||
/** A still for a video link: YouTube's own thumbnail. Other hosts
|
||||
* need an API call to find theirs, so they return null and the
|
||||
* card uses its uploaded image or a plain panel. */
|
||||
export function videoThumbnail(raw?: string | null): string | null {
|
||||
if (!raw) return null
|
||||
export function videoThumbnails(raw?: string | null): string[] {
|
||||
if (!raw) return []
|
||||
try {
|
||||
const id = youtubeId(new URL(raw.trim()))
|
||||
// hq720 is a 16:9 frame; hqdefault (every video has one) is 4:3
|
||||
// with black bars baked in, so it's only the fallback (VideoPlayer
|
||||
// swaps to it if hq720 is missing, and crops it to 16:9).
|
||||
return id ? `https://i.ytimg.com/vi/${encodeURIComponent(id)}/hq720.jpg` : null
|
||||
if (!id) return []
|
||||
// hq720 is a 16:9 frame but some videos lack it; hqdefault is 4:3
|
||||
// with black bars baked in (VideoPlayer crops them). A private or
|
||||
// removed video has neither, and YouTube answers with a gray
|
||||
// placeholder instead of an error, which VideoPlayer also skips.
|
||||
const base = `https://i.ytimg.com/vi/${encodeURIComponent(id)}`
|
||||
return [`${base}/hq720.jpg`, `${base}/hqdefault.jpg`]
|
||||
} catch {
|
||||
return null
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue