Skip to content

Commit

Permalink
Merge pull request #4018 from dpalou/MOBILE-4566
Browse files Browse the repository at this point in the history
Mobile 4566
  • Loading branch information
crazyserver authored Apr 24, 2024
2 parents bfd3752 + 1808d9a commit 718e1b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/addons/filter/mediaplugin/services/videojs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@ export class AddonFilterMediaPluginVideoJSService {
const videoWidth = player.videoWidth();
const videoHeight = player.videoHeight();
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) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/singletons/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class CoreMedia {
* @returns Whether needs conversion.
*/
static sourceNeedsConversion(source: CoreMediaSource): boolean {
if (!CorePlatform.isIOS()) {
if (!CorePlatform.isMobile()) {
return false;
}

Expand Down Expand Up @@ -84,7 +84,7 @@ export class CoreMedia {
* @returns Whether JS player should be used.
*/
static mediaUsesJavascriptPlayer(mediaElement: HTMLVideoElement | HTMLAudioElement): boolean {
if (!CorePlatform.isIOS()) {
if (!CorePlatform.isMobile()) {
return false;
}

Expand Down

0 comments on commit 718e1b1

Please sign in to comment.