From 205857fffe71c7ad91eade63a15e15340d8d1067 Mon Sep 17 00:00:00 2001 From: noam-heller1 Date: Sun, 28 Jul 2024 11:49:54 +0300 Subject: [PATCH 1/3] remove hls dynamic import - temporary --- .../gallery/src/components/item/videos/videoItem.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/gallery/src/components/item/videos/videoItem.js b/packages/gallery/src/components/item/videos/videoItem.js index 1fe373205..72e159573 100644 --- a/packages/gallery/src/components/item/videos/videoItem.js +++ b/packages/gallery/src/components/item/videos/videoItem.js @@ -2,6 +2,7 @@ import React from 'react'; import { GALLERY_CONSTS, window, utils } from 'pro-gallery-lib'; import { shouldCreateVideoPlaceholder } from '../itemHelper'; import { getStyle } from './getStyle'; +import Hls from 'hls.js'; class VideoItem extends React.Component { constructor(props) { @@ -55,13 +56,11 @@ class VideoItem extends React.Component { !(window && window.Hls) && this.isHLSVideo() ) { - import(/* webpackChunkName: "proGallery_HlsPlayer" */ 'hls.js').then( - (Player) => { - window.Hls = Player.default; - this.setState({ hlsPlayerLoaded: true }); - this.playVideoIfNeeded(); - } - ); + { + window.Hls = Hls; + this.setState({ hlsPlayerLoaded: true }); + this.playVideoIfNeeded(); + } } } From a8d69c30672e5140056ab87f9a33d7b12eaf8cb0 Mon Sep 17 00:00:00 2001 From: noam-heller1 Date: Sun, 28 Jul 2024 14:04:10 +0300 Subject: [PATCH 2/3] add auto playVideo import --- .../src/components/item/videos/videoItem.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/gallery/src/components/item/videos/videoItem.js b/packages/gallery/src/components/item/videos/videoItem.js index 72e159573..f69e7bd8b 100644 --- a/packages/gallery/src/components/item/videos/videoItem.js +++ b/packages/gallery/src/components/item/videos/videoItem.js @@ -2,7 +2,6 @@ import React from 'react'; import { GALLERY_CONSTS, window, utils } from 'pro-gallery-lib'; import { shouldCreateVideoPlaceholder } from '../itemHelper'; import { getStyle } from './getStyle'; -import Hls from 'hls.js'; class VideoItem extends React.Component { constructor(props) { @@ -21,6 +20,9 @@ class VideoItem extends React.Component { vimeoPlayerLoaded: false, hlsPlayerLoaded: false, }; + if (this.props.options.videoPlay === 'auto') { + this.dynamiclyImportVideoPlayers(); + } } componentDidMount() { @@ -57,9 +59,13 @@ class VideoItem extends React.Component { this.isHLSVideo() ) { { - window.Hls = Hls; - this.setState({ hlsPlayerLoaded: true }); - this.playVideoIfNeeded(); + import(/* webpackChunkName: "proGallery_HlsPlayer" */ 'hls.js').then( + (Player) => { + window.Hls = Player.default; + this.setState({ hlsPlayerLoaded: true }); + this.playVideoIfNeeded(); + } + ); } } } From ed72379b932e257b1963a090f68659adabb997f9 Mon Sep 17 00:00:00 2001 From: noam-heller1 Date: Sun, 28 Jul 2024 14:44:39 +0300 Subject: [PATCH 3/3] move to componentWillMount --- packages/gallery/src/components/item/videos/videoItem.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/gallery/src/components/item/videos/videoItem.js b/packages/gallery/src/components/item/videos/videoItem.js index f69e7bd8b..f68b2936b 100644 --- a/packages/gallery/src/components/item/videos/videoItem.js +++ b/packages/gallery/src/components/item/videos/videoItem.js @@ -20,15 +20,18 @@ class VideoItem extends React.Component { vimeoPlayerLoaded: false, hlsPlayerLoaded: false, }; - if (this.props.options.videoPlay === 'auto') { - this.dynamiclyImportVideoPlayers(); - } } componentDidMount() { this.dynamiclyImportVideoPlayers(); } + UNSAFE_componentWillMount() { + if (this.props.options.videoPlay === 'auto') { + this.dynamiclyImportVideoPlayers(); + } + } + dynamiclyImportVideoPlayers() { if (!(window && window.ReactPlayer)) { import(