From 21e2805ea187bf15eb2c618fc77112979613e4b0 Mon Sep 17 00:00:00 2001 From: frontned Date: Wed, 27 Mar 2024 11:14:48 +0200 Subject: [PATCH] hack for video item --- packages/gallery/src/components/item/videos/videoItem.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/gallery/src/components/item/videos/videoItem.js b/packages/gallery/src/components/item/videos/videoItem.js index 32837eef6..31cf78cd1 100644 --- a/packages/gallery/src/components/item/videos/videoItem.js +++ b/packages/gallery/src/components/item/videos/videoItem.js @@ -27,11 +27,11 @@ class VideoItem extends React.Component { } dynamiclyImportVideoPlayers() { - if (!(window && window.ReactPlayer)) { + if (!(window && window?.[window.location.href]?.ReactPlayer)) { import( /* webpackChunkName: "proGallery_reactPlayer" */ 'react-player' ).then((ReactPlayer) => { - window.ReactPlayer = ReactPlayer.default; + window[window.location.href] = { ReactPlayer: ReactPlayer.default }; this.setState({ reactPlayerLoaded: true }); this.playVideoIfNeeded(); }); @@ -144,13 +144,13 @@ class VideoItem extends React.Component { if ( !( window && - window.ReactPlayer && + window?.[window.location.href]?.ReactPlayer && (this.state.loadVideo || this.props.playing) ) ) { return null; } - const PlayerElement = window.ReactPlayer; + const PlayerElement = window?.[window.location.href]?.ReactPlayer; const isWiderThenContainer = this.props.style.ratio >= this.props.cropRatio; // adding 1 pixel to compensate for the difference we have sometimes from layouter in grid fill