Enhance YouTube player integration with fullscreen and picture-in-picture support

This commit is contained in:
CodeDevMLH
2026-03-06 03:18:13 +01:00
parent 8676160e7b
commit 03276d7722

View File

@@ -745,10 +745,11 @@ const SlideUtils = {
const ytIframe = this.createElement('iframe', { const ytIframe = this.createElement('iframe', {
id: 'modal-yt-player', id: 'modal-yt-player',
src: `https://www.youtube-nocookie.com/embed/${videoId}?enablejsapi=1&origin=${encodeURIComponent(window.location.origin)}`, src: `https://www.youtube-nocookie.com/embed/${videoId}?enablejsapi=1&origin=${encodeURIComponent(window.location.origin)}`,
allow: 'autoplay; encrypted-media', allow: 'autoplay; encrypted-media; fullscreen; picture-in-picture',
style: 'width: 100%; height: 100%; border: none;', style: 'width: 100%; height: 100%; border: none;',
referrerpolicy: 'strict-origin-when-cross-origin',
allowfullscreen: 'true'
}); });
ytIframe.setAttribute('referrerpolicy', 'strict-origin-when-cross-origin');
contentContainer.appendChild(ytIframe); contentContainer.appendChild(ytIframe);
overlay.append(closeButton, contentContainer); overlay.append(closeButton, contentContainer);
@@ -1750,8 +1751,9 @@ const SlideCreator = {
id: `youtube-player-${itemId}`, id: `youtube-player-${itemId}`,
src: `https://www.youtube-nocookie.com/embed/${videoId}?enablejsapi=1&origin=${encodeURIComponent(window.location.origin)}`, src: `https://www.youtube-nocookie.com/embed/${videoId}?enablejsapi=1&origin=${encodeURIComponent(window.location.origin)}`,
style: "width: 100%; height: 100%; border: none;", style: "width: 100%; height: 100%; border: none;",
allow: "autoplay; encrypted-media", allow: "autoplay; encrypted-media; fullscreen; picture-in-picture",
referrerpolicy: "strict-origin-when-cross-origin" referrerpolicy: "strict-origin-when-cross-origin",
allowfullscreen: "true"
}); });
videoBackdrop.appendChild(ytPlayerIframe); videoBackdrop.appendChild(ytPlayerIframe);