MOBILE-2567 ios: Fix download of streamed media

main
Dani Palou 2018-09-03 08:44:36 +02:00
parent 13307322fa
commit 8257341d13
2 changed files with 8 additions and 0 deletions

View File

@ -539,6 +539,10 @@ export class CoreCourseHelperProvider {
return this.downloadModuleWithMainFileIfNeeded(module, courseId, component, componentId, files, siteId)
.then((result) => {
if (result.path.indexOf('http') === 0) {
/* In iOS, if we use the same URL in embedded browser and background download then the download only
downloads a few bytes (cached ones). Add a hash to the URL so both URLs are different. */
result.path = result.path + '#moodlemobile-embedded';
return this.utils.openOnlineFile(result.path).catch((error) => {
// Error opening the file, some apps don't allow opening online files.
if (!this.fileProvider.isAvailable()) {

View File

@ -56,6 +56,10 @@ export class CoreFileHelperProvider {
}
if (url.indexOf('http') === 0) {
/* In iOS, if we use the same URL in embedded browser and background download then the download only
downloads a few bytes (cached ones). Add a hash to the URL so both URLs are different. */
url = url + '#moodlemobile-embedded';
return this.utils.openOnlineFile(url).catch((error) => {
// Error opening the file, some apps don't allow opening online files.
if (!this.fileProvider.isAvailable()) {