From 983466b5060845ed5875f3f41b7d56281ad9ed8d Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 30 Jul 2018 09:54:42 +0200 Subject: [PATCH] MOBILE-2476 media: Fix embedded media download in iOS --- src/directives/external-content.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/directives/external-content.ts b/src/directives/external-content.ts index 93a20ee76..160a59337 100644 --- a/src/directives/external-content.ts +++ b/src/directives/external-content.ts @@ -184,6 +184,12 @@ export class CoreExternalContentDirective implements AfterViewInit { } return promise.then((finalUrl) => { + if (finalUrl.match(/^https?:\/\//i)) { + /* In iOS, if we use the same URL in embedded file and background download then the download only + downloads a few bytes (cached ones). Add a hash to the URL so both URLs are different. */ + finalUrl = finalUrl + '#moodlemobile-embedded'; + } + this.logger.debug('Using URL ' + finalUrl + ' for ' + url); if (tagName === 'SOURCE') { // The browser does not catch changes in SRC, we need to add a new source.