MOBILE-2536 ios: Fix record media in iOS

main
Dani Palou 2018-08-07 08:46:48 +02:00
parent e6c5607463
commit 0ab2598235
1 changed files with 8 additions and 3 deletions

View File

@ -458,14 +458,19 @@ export class CoreFileUploaderHelperProvider {
// The mimetypes param is only for desktop apps, the Cordova plugin doesn't support it.
return promise.then((medias) => {
// We used limit 1, we only want 1 media.
const media: MediaFile = medias[0],
path = media.fullPath,
error = this.fileUploaderProvider.isInvalidMimetype(mimetypes, path); // Verify that the mimetype is supported.
const media: MediaFile = medias[0];
let path = media.fullPath;
const error = this.fileUploaderProvider.isInvalidMimetype(mimetypes, path); // Verify that the mimetype is supported.
if (error) {
return Promise.reject(error);
}
// Make sure the path has the protocol. In iOS it doesn't.
if (path.indexOf('file://') == -1) {
path = 'file://' + path;
}
if (upload) {
return this.uploadFile(path, maxSize, true, this.fileUploaderProvider.getMediaUploadOptions(media));
} else {