Open embeddable media straight into the player

This commit is contained in:
Fisto
2026-09-16 13:46:51 +02:00
parent 7f657cf29a
commit 5645f55356
3 changed files with 11 additions and 5 deletions
+5 -2
View File
@@ -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;