diff --git a/ui/component/app/view.jsx b/ui/component/app/view.jsx index 4ab5d4fbf..aadc719e4 100644 --- a/ui/component/app/view.jsx +++ b/ui/component/app/view.jsx @@ -5,7 +5,7 @@ import { lazyImport } from 'util/lazyImport'; import classnames from 'classnames'; import analytics from 'analytics'; import { buildURI, parseURI } from 'lbry-redux'; -import { SIMPLE_SITE } from 'config'; +import { SIMPLE_SITE, ENABLE_PREROLL_ADS } from 'config'; import Router from 'component/router/index'; import ReactModal from 'react-modal'; import { openContextMenu } from 'util/context-menu'; @@ -325,6 +325,23 @@ function App(props: Props) { } }, [previousRewardApproved, isRewardApproved]); + // Load IMA3 SDK for aniview + // @if TARGET='web' + useEffect(() => { + if (ENABLE_PREROLL_ADS) { + const script = document.createElement('script'); + script.src = `https://imasdk.googleapis.com/js/sdkloader/ima3.js`; + script.async = true; + // $FlowFixMe + document.body.appendChild(script); + return () => { + // $FlowFixMe + document.body.removeChild(script); + }; + } + }); + // @endif + // @if TARGET='app' useEffect(() => { if (updatePreferences && getWalletSyncPref && readyForPrefs) { diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index d27bf7f1d..73ee97457 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -624,8 +624,8 @@ export default React.memo(function VideoJs(props: Props) { const player = playerRef.current; if (player) { - window.player = undefined; player.dispose(); + window.player = undefined; } }; }, [isAudio]); @@ -664,22 +664,6 @@ export default React.memo(function VideoJs(props: Props) { }); }, [source, reload]); - // Load IMA3 SDK for aniview - // @if TARGET='web' - useEffect(() => { - const script = document.createElement('script'); - script.src = `https://imasdk.googleapis.com/js/sdkloader/ima3.js`; - script.async = true; - // $FlowFixMe - document.body.appendChild(script); - - return () => { - // $FlowFixMe - document.body.removeChild(script); - }; - }); - // @endif - return ( // $FlowFixMe