fix: Check if this is an embed player, and open the links to a new tab

This commit is contained in:
Yiannis Christodoulou 2025-09-29 09:43:38 +03:00
parent c7ad28572f
commit 4175a9d08f

View File

@ -129,7 +129,21 @@ class EndScreenOverlay extends Component {
// Add click handler // Add click handler
item.addEventListener('click', () => { item.addEventListener('click', () => {
// 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}`; window.location.href = `/view?m=${video.id}`;
}
}); });
return item; return item;