From d4947571a47d05dfa5c05cb863fb3921d2ce5234 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 3 Dec 2020 01:35:48 +0100 Subject: [PATCH] Try injecting notification UI --- src/ext/lib/video-data/PlayerData.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index 460a3e1..c6493e7 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -1,6 +1,7 @@ import Debug from '../../conf/Debug'; import ExtensionMode from '../../../common/enums/extension-mode.enum' import AspectRatio from '../../../common/enums/aspect-ratio.enum'; +import PlayerNotificationUi from '../uwui/PlayerNotificationUI'; if (process.env.CHANNEL !== 'stable'){ console.info("Loading: PlayerData.js"); @@ -43,6 +44,7 @@ class PlayerData { this.extensionMode = videoData.extensionMode; this.invalid = false; this.element = this.getPlayer(); + this.notificationService = new PlayerNotificationUi(this.element); this.dimensions = undefined; this.overlayNode = undefined; @@ -97,6 +99,7 @@ class PlayerData { destroy() { this.stopChangeDetection(); this.destroyOverlay(); + this.notificationService?.destroy(); } startChangeDetection(){ @@ -218,6 +221,11 @@ class PlayerData { fullscreen: isFullScreen }; + + // NOTE: it's possible that notificationService hasn't been initialized yet at this point. + // no biggie if it wasn't, we just won't replace the notification UI + this.notificationService?.replace(player); + // actually re-calculate zoom when player size changes, but only if videoData.resizer // is defined. Since resizer needs a PlayerData object to exist, videoData.resizer will // be undefined the first time this function will run.