Skip to content

Commit

Permalink
Merge pull request #3290 from dpalou/MOBILE-4082
Browse files Browse the repository at this point in the history
MOBILE-4082 video: Fix subtitles wider than video
  • Loading branch information
crazyserver authored May 24, 2022
2 parents 9d3a97d + 995b475 commit 477254e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/core/directives/external-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import { CoreFilepool, CoreFilepoolFileActions, CoreFilepoolFileEventData } from
import { CoreSites } from '@services/sites';
import { CoreUrlUtils } from '@services/utils/url';
import { CoreUtils } from '@services/utils/utils';
import { Platform } from '@singletons';
import { CoreLogger } from '@singletons/logger';
import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/site';
Expand Down Expand Up @@ -304,12 +303,10 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O
return;
}

const line = Platform.is('tablet') || CoreApp.isAndroid() ? 90 : 80;
// Position all subtitles to a percentage of video height.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Array.from(track.cues).forEach((cue: any) => {
Array.from(track.cues).forEach((cue: VTTCue) => {
cue.snapToLines = false;
cue.line = line;
cue.line = 90;
cue.size = 100; // This solves some Android issue.
});
// Delete listener.
Expand Down
5 changes: 5 additions & 0 deletions src/theme/theme.base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1725,3 +1725,8 @@ ion-header.no-title {
bottom: 0;
}
}

// Fix subtitles wider than video.
video::-webkit-media-text-track-display {
white-space: normal !important;
}

0 comments on commit 477254e

Please sign in to comment.