From b819fc816b08954ecccdb8d3bdb2250045e26fed Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Wed, 13 Jan 2021 01:12:03 +0100 Subject: [PATCH] Fix DRM detection for Chrome --- src/ext/lib/ar-detect/ArDetector.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ext/lib/ar-detect/ArDetector.js b/src/ext/lib/ar-detect/ArDetector.js index d5ed0e0..ad8f058 100644 --- a/src/ext/lib/ar-detect/ArDetector.js +++ b/src/ext/lib/ar-detect/ArDetector.js @@ -526,6 +526,13 @@ class ArDetector { * completely opaque (i.e. have value of 255)) */ hasDRM() { + // oh btw, there's one exception. 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. + if (! this.conf.hasVideoStartedPlaying()) { + return false; + } return this.blackframeContext.getImageData(0,0,1,1).data[3] === 0; }