From 4175a9d08f3adb0f4946bfa815219ddfcb5b4ea9 Mon Sep 17 00:00:00 2001 From: Yiannis Christodoulou Date: Mon, 29 Sep 2025 09:43:38 +0300 Subject: [PATCH] fix: Check if this is an embed player, and open the links to a new tab --- .../src/components/overlays/EndScreenOverlay.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend-tools/video-js/src/components/overlays/EndScreenOverlay.js b/frontend-tools/video-js/src/components/overlays/EndScreenOverlay.js index 8326d5b2..1de9f02e 100644 --- a/frontend-tools/video-js/src/components/overlays/EndScreenOverlay.js +++ b/frontend-tools/video-js/src/components/overlays/EndScreenOverlay.js @@ -129,7 +129,21 @@ class EndScreenOverlay extends Component { // Add click handler item.addEventListener('click', () => { - window.location.href = `/view?m=${video.id}`; + // Check if this is an embed player - use multiple methods for reliability + const playerId = this.player().id() || this.player().options_.id; + const isEmbedPlayer = + playerId === 'video-embed' || + window.location.pathname.includes('/embed') || + window.location.search.includes('embed') || + window.parent !== window; // Most reliable check for iframe + + if (isEmbedPlayer) { + // Open in new tab/window for embed players + window.open(`/view?m=${video.id}`, '_blank', 'noopener,noreferrer'); + } else { + // Navigate in same window for regular players + window.location.href = `/view?m=${video.id}`; + } }); return item;