From 83b8ce0aaaf57ed9a0354c2f36fcb6bb3b535e06 Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 18 Feb 2021 19:03:32 +0100 Subject: [PATCH 1/2] Fix drm detection, but hopefully for real --- src/ext/lib/ar-detect/DrmDetecor.js | 46 +---------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/src/ext/lib/ar-detect/DrmDetecor.js b/src/ext/lib/ar-detect/DrmDetecor.js index b98f977..a7a2012 100644 --- a/src/ext/lib/ar-detect/DrmDetecor.js +++ b/src/ext/lib/ar-detect/DrmDetecor.js @@ -1,5 +1,3 @@ -import BrowserDetect from '../../conf/BrowserDetect'; - /** * Checks whether video we're trying to play is protected by DRM. * @param {*} video video we're trying to check @@ -10,47 +8,5 @@ export function hasDrm(video) { return undefined; } - /** - * DRM DETECTION 101: - * - * When trying to get an image frame of a DRM-protected video in - * firefox, the method canvas.drawImage(video) will throw an exception. - * - * This doesn't happen in Chrome. As opposed to Firefox, chrome will - * simply draw a transparent black image and not tell anyone that - * anything is amiss. However, since the image is (according to my testing - * on netflix) completely transparent, this means we can determine whether - * the video is DRM-protected by looking at the alpha byte of the image. - * - * (Videos don't tend to have an alpha channel, so they're always - * completely opaque (i.e. have value of 255)) - */ - - // setup canvas - const canvas = document.createElement('canvas'); - canvas.width = 2; - canvas.height = 2; - const context = canvas.getContext('2d'); - - if (BrowserDetect.firefox) { - try { - context.drawImage(video, 0, 0, canvas.width, canvas.height); - return false; - } catch (e) { - console.error('Exception occured while trying to draw image. Error:', e); - return true; - } - } else if (BrowserDetect.anyChromium) { - // oh btw, there's one exception to the alpha rule. - // There is this brief period between the point - // when metadata (video dimensions) have loaded and the moment the video starts - // playing where ctx.drawImage() will draw a transparent black square regardless - // of whether the video is actually DRM-protected or not. - - context.drawImage(video, 0, 0, canvas.width, canvas.height); - - console.log(context.getImageData(0,0,1,1).data, 'drm result', video.videoTracks) - - return context.getImageData(0,0,1,1).data[3] === 0; - } + return video.mediaKeys instanceof MediaKeys; } \ No newline at end of file From 888ffcadedf290b845ed139c95fb85d50c41036d Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 18 Feb 2021 19:06:23 +0100 Subject: [PATCH 2/2] Version bump & update notes --- CHANGELOG.md | 2 +- src/manifest.json | 2 +- src/popup/panels/WhatsNewPanel.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c716e20..ba887f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ * Provides workaround for the fullscreen stretching bug Chrome 88 (or a recent Windows 10 update) introduced for nVidia users using hardware acceleration on Windows 10. In order to mitigate this bug, Ultrawidify needs to keep a 5-10 px wide black border while watching videos in full screen. This bug is also present in Edge. * **[4.5.3.1]** Fixed letterbox misalignment binding in settings (#134) -* **[4.5.3.1]** Fixed false 'autodetection not supported' notifications. +* **[4.5.3.2]** Fixed false 'autodetection not supported' notifications. ### v4.5.2 diff --git a/src/manifest.json b/src/manifest.json index a859168..3294fc1 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Ultrawidify", "description": "Removes black bars on ultrawide videos and offers advanced options to fix aspect ratio.", - "version": "4.5.3.1", + "version": "4.5.3.2", "applications": { "gecko": { "id": "{cf02b1a7-a01a-4e37-a609-516a283f1ed3}" diff --git a/src/popup/panels/WhatsNewPanel.vue b/src/popup/panels/WhatsNewPanel.vue index fce5e25..39e0fad 100644 --- a/src/popup/panels/WhatsNewPanel.vue +++ b/src/popup/panels/WhatsNewPanel.vue @@ -11,7 +11,7 @@ [4.5.3.1] Fixed binding for letterbox misalignment treshold binding in settings.
  • - [4.5.3.1] Removed false positive "this extension can't work due to DRM" notifications. Note that this also gets rid of all such notifications in non-Firefox browsers. + [4.5.3.2] Removed false positive "this extension can't work due to DRM" notifications.