Get DRM status to UI more reliably
This commit is contained in:
parent
3d35ae32c8
commit
55c0e7e8c5
@ -127,7 +127,7 @@
|
||||
</SupportLevelIndicator>
|
||||
<div v-if="statusFlags.hasDrm" class="aard-blocked">
|
||||
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 v-else-if="statusFlags.aardErrors?.cors" class="aard-blocked">
|
||||
Autodetection blocked<br/>
|
||||
@ -327,6 +327,7 @@ export default {
|
||||
(data) => {
|
||||
switch (data.type) {
|
||||
case 'drm-status':
|
||||
console.log('got DRM status!');
|
||||
this.statusFlags.hasDrm = data.hasDrm;
|
||||
break;
|
||||
case 'aard-error':
|
||||
@ -493,6 +494,9 @@ export default {
|
||||
|
||||
preventContextMenuHide() {
|
||||
this.contextMenuActive = true;
|
||||
|
||||
// refresh DRM status
|
||||
this.eventBus.sendToTunnel('get-drm-status');
|
||||
},
|
||||
allowContextMenuHide() {
|
||||
this.contextMenuActive = false;
|
||||
@ -511,7 +515,7 @@ export default {
|
||||
this.allowContextMenuHide();
|
||||
|
||||
// refresh DRM status
|
||||
this.eventBus.send('get-drm-status');
|
||||
this.eventBus.sendToTunnel('get-drm-status');
|
||||
|
||||
// if (this.isGlobal) {
|
||||
// this.sendToParentLowLevel('uwui-clickable', undefined, {clickable: true});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Checks whether video we're trying to play is protected by DRM.
|
||||
* Checks whether video we're trying to play is protected by DRM.
|
||||
* @param {*} video video we're trying to check
|
||||
*/
|
||||
export function hasDrm(video) {
|
||||
@ -9,4 +9,4 @@ export function hasDrm(video) {
|
||||
}
|
||||
|
||||
return video.mediaKeys instanceof MediaKeys;
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,6 @@ class VideoData {
|
||||
|
||||
async onVideoLoaded() {
|
||||
if (!this.videoLoaded) {
|
||||
|
||||
/**
|
||||
* video.readyState 101:
|
||||
* 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.hasDrm = hasDrm(this.video);
|
||||
this.eventBus.send(
|
||||
'uw-config-broadcast', {
|
||||
type: 'drm-status',
|
||||
hasDrm: this.hasDrm
|
||||
});
|
||||
this.videoLoaded = true;
|
||||
this.videoDimensionsLoaded = true;
|
||||
try {
|
||||
@ -678,11 +683,12 @@ class VideoData {
|
||||
}
|
||||
|
||||
try {
|
||||
if (hasDrm(this.video)) {
|
||||
this.hasDrm = true;
|
||||
} else {
|
||||
this.hasDrm = false;
|
||||
}
|
||||
this.hasDrm = !!hasDrm(this.video);
|
||||
this.eventBus.send(
|
||||
'uw-config-broadcast', {
|
||||
type: 'drm-status',
|
||||
hasDrm: this.hasDrm
|
||||
});
|
||||
|
||||
if (!this.aard) {
|
||||
this.initArDetection();
|
||||
|
Loading…
Reference in New Issue
Block a user