Merge branch 'master' into typescriptify

This commit is contained in:
Tamius Han 2021-02-18 19:06:37 +01:00
commit 7e49b493bb
4 changed files with 4 additions and 48 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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}"

View File

@ -11,7 +11,7 @@
<b>[4.5.3.1]</b> Fixed binding for letterbox misalignment treshold binding in settings.
</li>
<li>
<b>[4.5.3.1]</b> 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.
<b>[4.5.3.2]</b> Removed false positive "this extension can't work due to DRM" notifications.
</li>
</ul>
</div>