Get DRM status to UI more reliably

This commit is contained in:
Tamius Han 2025-01-05 02:47:45 +01:00
parent 3d35ae32c8
commit 55c0e7e8c5
3 changed files with 20 additions and 10 deletions

View File

@ -127,7 +127,7 @@
</SupportLevelIndicator> </SupportLevelIndicator>
<div v-if="statusFlags.hasDrm" class="aard-blocked"> <div v-if="statusFlags.hasDrm" class="aard-blocked">
Autodetection potentially<br/> Autodetection potentially<br/>
unavailable due to <a href="https://en.wikipedia.org/wiki/Digital_rights_management">DRM</a>. unavailable due to <a style="color: #fff" href="https://en.wikipedia.org/wiki/Digital_rights_management" target="_blank">DRM</a>.
</div> </div>
<div v-else-if="statusFlags.aardErrors?.cors" class="aard-blocked"> <div v-else-if="statusFlags.aardErrors?.cors" class="aard-blocked">
Autodetection blocked<br/> Autodetection blocked<br/>
@ -327,6 +327,7 @@ export default {
(data) => { (data) => {
switch (data.type) { switch (data.type) {
case 'drm-status': case 'drm-status':
console.log('got DRM status!');
this.statusFlags.hasDrm = data.hasDrm; this.statusFlags.hasDrm = data.hasDrm;
break; break;
case 'aard-error': case 'aard-error':
@ -493,6 +494,9 @@ export default {
preventContextMenuHide() { preventContextMenuHide() {
this.contextMenuActive = true; this.contextMenuActive = true;
// refresh DRM status
this.eventBus.sendToTunnel('get-drm-status');
}, },
allowContextMenuHide() { allowContextMenuHide() {
this.contextMenuActive = false; this.contextMenuActive = false;
@ -511,7 +515,7 @@ export default {
this.allowContextMenuHide(); this.allowContextMenuHide();
// refresh DRM status // refresh DRM status
this.eventBus.send('get-drm-status'); this.eventBus.sendToTunnel('get-drm-status');
// if (this.isGlobal) { // if (this.isGlobal) {
// this.sendToParentLowLevel('uwui-clickable', undefined, {clickable: true}); // this.sendToParentLowLevel('uwui-clickable', undefined, {clickable: true});

View File

@ -146,7 +146,6 @@ class VideoData {
async onVideoLoaded() { async onVideoLoaded() {
if (!this.videoLoaded) { if (!this.videoLoaded) {
/** /**
* video.readyState 101: * video.readyState 101:
* 0 no info. Can't play. * 0 no info. Can't play.
@ -160,6 +159,12 @@ class VideoData {
} }
this.logger.log('info', 'init', '%c[VideoData::onVideoLoaded] ——————————— Initiating phase two of videoData setup ———————————', 'color: #0f9'); this.logger.log('info', 'init', '%c[VideoData::onVideoLoaded] ——————————— Initiating phase two of videoData setup ———————————', 'color: #0f9');
this.hasDrm = hasDrm(this.video);
this.eventBus.send(
'uw-config-broadcast', {
type: 'drm-status',
hasDrm: this.hasDrm
});
this.videoLoaded = true; this.videoLoaded = true;
this.videoDimensionsLoaded = true; this.videoDimensionsLoaded = true;
try { try {
@ -678,11 +683,12 @@ class VideoData {
} }
try { try {
if (hasDrm(this.video)) { this.hasDrm = !!hasDrm(this.video);
this.hasDrm = true; this.eventBus.send(
} else { 'uw-config-broadcast', {
this.hasDrm = false; type: 'drm-status',
} hasDrm: this.hasDrm
});
if (!this.aard) { if (!this.aard) {
this.initArDetection(); this.initArDetection();