Fix chrome condition test
This commit is contained in:
parent
71cb357424
commit
0aa7beb525
@ -255,24 +255,31 @@ squeezeFactor: ${squeezeFactor}`, '\nvideo', this.conf.video);
|
|||||||
* style attribute does).
|
* style attribute does).
|
||||||
*/
|
*/
|
||||||
chromeBugMitigation(stretchFactors) {
|
chromeBugMitigation(stretchFactors) {
|
||||||
if (BrowserDetect.anyChromium && this.conf.player?.isFullScreen && this.conf.player?.dimensions?.fullscreen) {
|
if (BrowserDetect.anyChromium && this.conf.player?.isFullScreen && this.conf.player?.dimensions?.fullscreen) {
|
||||||
const playerAr = playerArOverride || this.conf.player.dimensions.width / this.conf.player.dimensions.height;
|
const playerAr = playerArOverride || this.conf.player.dimensions.width / this.conf.player.dimensions.height;
|
||||||
const streamAr = this.conf.video.videoWidth / this.conf.video.videoHeight;
|
const streamAr = this.conf.video.videoWidth / this.conf.video.videoHeight;
|
||||||
|
|
||||||
let maxSafeAr;
|
let maxSafeAr;
|
||||||
|
|
||||||
if (playerAr >= (streamAr * 1.1)) {
|
if (playerAr >= (streamAr * 1.1)) {
|
||||||
maxSafeAr = (window.innerWidth * 0.997) / window.innerHeight;
|
maxSafeAr = (window.innerWidth * 0.997) / window.innerHeight;
|
||||||
} else if (playerAr < (streamAr * 0.95)) {
|
} else if (playerAr < (streamAr * 0.95)) {
|
||||||
maxSafeAr = window.innerWidth / (window.innerHeight * 0.997);
|
maxSafeAr = window.innerWidth / (window.innerHeight * 0.997);
|
||||||
} else {
|
} else {
|
||||||
// in some cases, we tolerate minor stretch to avoid tiny black bars
|
// in some cases, we tolerate minor stretch to avoid tiny black bars
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
stretchFactors.xFactor = Math.min(stretchFactors.xFactor, maxSafeAr);
|
|
||||||
stretchFactors.yFactor = Math.min(stretchFactors.yFactor, maxSafeAr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const maxSafeStretchFactor = this.conf.resizer.stretcher.calculateCrop(maxSafeAr).xFactor;
|
||||||
|
|
||||||
|
console.info('Stretch factors before:', stretchFactors.xFactor, stretchFactors.yFactor, "max safe:", maxSafeStretchFactor, "max safe ar:", maxSafeAr);
|
||||||
|
|
||||||
|
stretchFactors.xFactor = Math.min(stretchFactors.xFactor, maxSafeStretchFactor);
|
||||||
|
stretchFactors.yFactor = Math.min(stretchFactors.yFactor, maxSafeStretchFactor);
|
||||||
|
|
||||||
|
console.info('Stretch factors after:', stretchFactors.xFactor, stretchFactors.yFactor);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user