MOBILE-4566 media: Fix videojs videos wider than viewport

main
Dani Palou 2024-04-24 12:51:09 +02:00
parent aae5002b2c
commit 1808d9adfc
1 changed files with 8 additions and 0 deletions

View File

@ -165,6 +165,14 @@ export class AddonFilterMediaPluginVideoJSService {
const videoWidth = player.videoWidth(); const videoWidth = player.videoWidth();
const videoHeight = player.videoHeight(); const videoHeight = player.videoHeight();
const playerDimensions = player.currentDimensions(); const playerDimensions = player.currentDimensions();
const offsetParentWidth = player.el().offsetParent?.clientWidth;
if (offsetParentWidth && playerDimensions.width > offsetParentWidth) {
// The player is bigger than the container. Resize it.
player.dimension('width', offsetParentWidth);
playerDimensions.width = offsetParentWidth;
}
if (!videoWidth || !videoHeight || !playerDimensions.width || videoWidth === playerDimensions.width) { if (!videoWidth || !videoHeight || !playerDimensions.width || videoWidth === playerDimensions.width) {
return; return;
} }