From 88dec55116dbc5f9e58e66bd5a1a1d62ed230ab2 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 28 Jul 2022 00:45:27 +0200 Subject: [PATCH] get DRM status in player ui --- src/csui/PlayerUiBase.vue | 40 +++++++++++++---------------- src/ext/lib/video-data/VideoData.ts | 5 ++++ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/csui/PlayerUiBase.vue b/src/csui/PlayerUiBase.vue index f96882a..52e5804 100644 --- a/src/csui/PlayerUiBase.vue +++ b/src/csui/PlayerUiBase.vue @@ -78,22 +78,13 @@
-
+
-
- DRM warnings will appear in this box
- Learn more ... -
-
-
- -
-
-
- -
This site is blocking automatic aspect ratio detection. You will have to adjust aspect ratio manually.
Learn more ... @@ -201,6 +192,10 @@ export default { }, debugDataPrettified: '', + statusFlags: { + hasDrm: undefined, + }, + tabs: [ {id: 'videoSettings', label: 'Video settings', icon: 'crop'}, {id: 'playerDetection', label: 'Player detection', icon: 'television-play'}, @@ -212,12 +207,6 @@ export default { }; }, computed: { - // we don't have vuex here at the moment, so no mapState yet! - // ...mapState([ - // 'showUi', - // 'resizerDebugData', - // 'playerDebugData' - // ]), // LPT: NO ARROW FUNCTIONS IN COMPUTED, // IS SUPER HARAM // THINGS WILL NOT WORK IF YOU USE ARROWS @@ -249,8 +238,6 @@ export default { }, async created() { - console.log('player-tree: player UI base created') - this.logger = new Logger(); await this.logger.init({ allowLogging: true, @@ -278,6 +265,12 @@ export default { } }, this.origin); }); + + this.eventBus.subscribe('uw-config-broadcast', (data) => { + if (data.type === 'drm-status') { + this.statusFlags.hasDrm = data.hasDrm; + } + }); }, methods: { @@ -324,7 +317,7 @@ export default { this.uwTriggerZoneTimeout = setTimeout( () => this.uwTriggerZoneVisible = false, 250 - ) + ); } /* we check if our mouse is hovering over an element. @@ -363,6 +356,9 @@ export default { this.uwWindowFadeOut = false; this.uwWindowVisible = true; this.uwTriggerZoneVisible = false; + + // refresh DRM status + this.eventBus.send('get-drm-status'); }, hideUwWindow() { diff --git a/src/ext/lib/video-data/VideoData.ts b/src/ext/lib/video-data/VideoData.ts index c6fa4ce..f50026b 100644 --- a/src/ext/lib/video-data/VideoData.ts +++ b/src/ext/lib/video-data/VideoData.ts @@ -92,6 +92,10 @@ class VideoData { if (pageInfo.eventBus) { this.eventBus.setUpstreamBus(pageInfo.eventBus); + this.eventBus.subscribe('get-drm-status', {function: () => { + this.hasDrm = hasDrm(this.video); + this.eventBus.send('uw-config-broadcast', {type: 'drm-status', hasDrm: this.hasDrm}); + }}); } @@ -634,6 +638,7 @@ class VideoData { } } + startArDetection() { this.logger.log('info', 'debug', "[VideoData::startArDetection] starting AR detection") if(this.destroyed || this.invalid) {