Skip to content

Commit

Permalink
hack for video item (#1205)
Browse files Browse the repository at this point in the history
  • Loading branch information
frontned authored Mar 27, 2024
1 parent c457ba1 commit 1f0257a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/gallery/src/components/item/videos/videoItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1f0257a

Please sign in to comment.