MOBILE-3320 android: Fix subtitles in videos not seen

main
Dani Palou 2021-06-14 10:47:24 +02:00
parent 4a34dab790
commit 9ddce87347
1 changed files with 6 additions and 1 deletions

View File

@ -188,7 +188,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges {
if (tagName == 'VIDEO' && targetAttr != 'poster') { if (tagName == 'VIDEO' && targetAttr != 'poster') {
const video = <HTMLVideoElement> this.element; const video = <HTMLVideoElement> this.element;
if (video.textTracks) { if (video.textTracks) {
// It's a video with subtitles. In iOS, subtitles position is wrong so it needs to be fixed. // It's a video with subtitles. Fix some issues with subtitles.
video.textTracks.onaddtrack = (event): void => { video.textTracks.onaddtrack = (event): void => {
const track = <TextTrack> event.track; const track = <TextTrack> event.track;
if (track) { if (track) {
@ -248,6 +248,11 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges {
true, true,
downloadUnknown, downloadUnknown,
); );
} else if (tagName === 'TRACK') {
// Download tracks right away. Using an online URL for tracks can give a CORS error in Android.
finalUrl = await CoreFilepool.downloadUrl(site.getId(), url, false, this.component, this.componentId);
finalUrl = CoreFile.convertFileSrc(finalUrl);
} else { } else {
finalUrl = await CoreFilepool.getUrlByUrl( finalUrl = await CoreFilepool.getUrlByUrl(
site.getId(), site.getId(),