aniview only web - v0.1 #6898

Merged
jessopb merged 1 commit from aniview-only-web into master 2021-08-18 17:00:51 +02:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit 24ee71a00b - Show all commits

View file

@ -97,7 +97,7 @@ class AniviewPlugin extends Component {
} }
} }
videojs.registerComponent('recsys', AniviewPlugin); videojs.registerComponent('aniview', AniviewPlugin);
const onPlayerReady = (player, options) => { const onPlayerReady = (player, options) => {
player.aniview = new AniviewPlugin(player, options); player.aniview = new AniviewPlugin(player, options);

View file

@ -13,8 +13,9 @@ import hlsQualitySelector from './plugins/videojs-hls-quality-selector/plugin';
import recsys from './plugins/videojs-recsys/plugin'; import recsys from './plugins/videojs-recsys/plugin';
import qualityLevels from 'videojs-contrib-quality-levels'; import qualityLevels from 'videojs-contrib-quality-levels';
import isUserTyping from 'util/detect-typing'; import isUserTyping from 'util/detect-typing';
// @if TARGET='web'
import './plugins/videojs-aniview/plugin'; import './plugins/videojs-aniview/plugin';
// @endif
const isDev = process.env.NODE_ENV !== 'production'; const isDev = process.env.NODE_ENV !== 'production';
export type Player = { export type Player = {
@ -585,9 +586,11 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// This must be initialized earlier than everything else // This must be initialized earlier than everything else
// otherwise a race condition occurs if we place this in the onReady call back // otherwise a race condition occurs if we place this in the onReady call back
// allow if isDev because otherwise you'll never see ads when basing to master // allow if isDev because otherwise you'll never see ads when basing to master
// @if TARGET='web'
if ((allowPreRoll && SIMPLE_SITE) || isDev) { if ((allowPreRoll && SIMPLE_SITE) || isDev) {
vjs.aniview(); vjs.aniview();
} }
// @endif
// fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498) // fixes #3498 (https://github.com/lbryio/lbry-desktop/issues/3498)
// summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar // summary: on firefox the focus would stick to the fullscreen button which caused buggy behavior with spacebar
@ -662,6 +665,7 @@ 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`;
@ -674,6 +678,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
document.body.removeChild(script); document.body.removeChild(script);
}; };
}); });
// @endif
return ( return (
// $FlowFixMe // $FlowFixMe