Open embeddable media straight into the player
This commit is contained in:
+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