Open embeddable media straight into the player
This commit is contained in:
@@ -40,6 +40,9 @@ mobile draft at 390px.
|
||||
- [x] C11 preview caching: Discord-hosted image/GIF previews (WebP 320px, hash-addressed, 5 MiB
|
||||
cap, one attempt) run after every walk in both modes. Live run `...-20260916090722`:
|
||||
`previewed: 2`; thumbs served over `/api/media/<scrape>/<item>/thumb` (200).
|
||||
- [x] C24 Embeddable items open straight into their player: clicking a YouTube/Vimeo/Twitch/
|
||||
Streamable card shows the iframe immediately, no extra play press. Non-embeddable videos keep
|
||||
the still + play icon.
|
||||
- [x] C23 Grid and viewer source fixes. The grid now prefers the cached still (or local file) for
|
||||
every kind, and only falls back to a first-frame video, served through the same-origin stream
|
||||
endpoint instead of hotlinked CDN/redirector URLs (fixes fxtwitter/YouTube previews that ORB
|
||||
|
||||
+3
-3
@@ -152,9 +152,9 @@ that deletion is irreversible. The delete button is disabled for a 5 second coun
|
||||
so a video without a cached preview renders a first-frame `<video>` in the grid, and downloaded
|
||||
videos get an ffmpeg poster cached in `thumbs/`. Clicking a tile opens a viewer: wide media
|
||||
shows the metadata banner below, vertical media shows it to the right, and videos carry a large
|
||||
play icon top-right. The play action embeds a YouTube, Vimeo, Twitch, or Streamable player, or
|
||||
plays a direct mp4/webm/m4v; when neither is possible it opens the external-site warning, since
|
||||
the page is the only way to watch. Playback and **View full** go through
|
||||
play icon top-right. An embeddable item (YouTube, Vimeo, Twitch, Streamable) opens straight into
|
||||
its player; other videos play a direct mp4/webm/m4v, and when neither is possible the play
|
||||
action opens the external-site warning, since the page is the only way to watch. Playback and **View full** go through
|
||||
` /api/media/<scrape>/<item>/stream`, which serves the local file or re-fetches the source message
|
||||
for a fresh signed URL, so expired CDN links still play. The grid prefers the cached still; a
|
||||
video without one gets its first frame through the same-origin stream endpoint, which avoids
|
||||
|
||||
+5
-2
@@ -1122,16 +1122,19 @@
|
||||
const directVideo = item.localUrl || (item.kind === "video" ? streamUrl : null);
|
||||
const canPlay = !!embed || (item.kind === "video" && !!directVideo);
|
||||
|
||||
// An embeddable item (YouTube, Vimeo, ...) opens straight into its player.
|
||||
const showPlayer = play || !!embed;
|
||||
|
||||
// A play request on something we cannot play falls back to the external page.
|
||||
if (play && !canPlay) openLinkWarning(item.url);
|
||||
|
||||
if (play && embed) {
|
||||
if (showPlayer && embed) {
|
||||
const frame = document.createElement("iframe");
|
||||
frame.src = embed;
|
||||
frame.allow = "autoplay; fullscreen; picture-in-picture";
|
||||
frame.allowFullscreen = true;
|
||||
media.append(frame);
|
||||
} else if (play && directVideo) {
|
||||
} else if (showPlayer && directVideo) {
|
||||
const video = document.createElement("video");
|
||||
video.controls = true;
|
||||
video.autoplay = true;
|
||||
|
||||
Reference in New Issue
Block a user