From dc2dc823a87d27cb541300c24cf80fcd2c1fa254 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Fri, 11 Feb 2022 00:40:42 +0300 Subject: [PATCH] Display physical dimensions of player When using browser or system-wide scaling, the player size changes, misleading the user. --- src/plugins/htmlVideoPlayer/plugin.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 783a49e6b6..2b49f99d6a 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1869,9 +1869,10 @@ function tryRemoveElement(elem) { }; categories.push(videoCategory); + const devicePixelRatio = window.devicePixelRatio || 1; const rect = mediaElement.getBoundingClientRect ? mediaElement.getBoundingClientRect() : {}; - let height = parseInt(rect.height); - let width = parseInt(rect.width); + let height = Math.round(rect.height * devicePixelRatio); + let width = Math.round(rect.width * devicePixelRatio); // Don't show player dimensions on smart TVs because the app UI could be lower resolution than the video and this causes users to think there is a problem if (width && height && !browser.tv) {