Fix video dispose #6904
2 changed files with 32 additions and 17 deletions
|
@ -5,7 +5,7 @@ import { lazyImport } from 'util/lazyImport';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import analytics from 'analytics';
|
import analytics from 'analytics';
|
||||||
import { buildURI, parseURI } from 'lbry-redux';
|
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 Router from 'component/router/index';
|
||||||
import ReactModal from 'react-modal';
|
import ReactModal from 'react-modal';
|
||||||
import { openContextMenu } from 'util/context-menu';
|
import { openContextMenu } from 'util/context-menu';
|
||||||
|
@ -325,6 +325,23 @@ function App(props: Props) {
|
||||||
}
|
}
|
||||||
}, [previousRewardApproved, isRewardApproved]);
|
}, [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'
|
// @if TARGET='app'
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (updatePreferences && getWalletSyncPref && readyForPrefs) {
|
if (updatePreferences && getWalletSyncPref && readyForPrefs) {
|
||||||
|
|
|
@ -624,8 +624,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
|
|
||||||
const player = playerRef.current;
|
const player = playerRef.current;
|
||||||
if (player) {
|
if (player) {
|
||||||
window.player = undefined;
|
|
||||||
player.dispose();
|
player.dispose();
|
||||||
|
window.player = undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [isAudio]);
|
}, [isAudio]);
|
||||||
|
@ -664,21 +664,19 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
});
|
});
|
||||||
}, [source, reload]);
|
}, [source, reload]);
|
||||||
|
|
||||||
// Load IMA3 SDK for aniview
|
// // Load IMA3 SDK for aniview
|
||||||
// @if TARGET='web'
|
// useEffect(() => {
|
||||||
useEffect(() => {
|
// const script = document.createElement('script');
|
||||||
const script = document.createElement('script');
|
// script.src = `https://imasdk.googleapis.com/js/sdkloader/ima3.js`;
|
||||||
script.src = `https://imasdk.googleapis.com/js/sdkloader/ima3.js`;
|
// script.async = true;
|
||||||
script.async = true;
|
// // $FlowFixMe
|
||||||
// $FlowFixMe
|
// document.body.appendChild(script);
|
||||||
document.body.appendChild(script);
|
//
|
||||||
|
// return () => {
|
||||||
return () => {
|
// // $FlowFixMe
|
||||||
// $FlowFixMe
|
// document.body.removeChild(script);
|
||||||
document.body.removeChild(script);
|
// };
|
||||||
};
|
// });
|
||||||
});
|
|
||||||
// @endif
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
|
|
Loading…
Reference in a new issue