From 689a6299cc4cc83726e155b1f159ef410a469d0f Mon Sep 17 00:00:00 2001 From: Equilibrium ITO Date: Mon, 11 Mar 2024 16:05:59 +0100 Subject: [PATCH] upload image as video on publication solved --- .../new-publication/new-publication.page.ts | 64 +++++++++---------- src/app/services/attachments.service.ts | 2 +- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index dc36e34f8..9838c98d0 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -277,43 +277,37 @@ export class NewPublicationPage implements OnInit { } } - async loadVideo() { - - const result = await FilePicker.pickMedia - ({ - multiple: true, - }); - console.log(result.files) - result.files.forEach(async element => { - - this.filesSizeSum = this.filesSizeSum + element.size - if (this.fileSizeToMB(this.filesSizeSum) <= 20) { - console.log('pass size verificartion') - if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { + async loadVideo() { + const result = await FilePicker.pickMedia ({ multiple: true, }); + console.log(result.files) + result.files.forEach(async element => { + this.filesSizeSum = this.filesSizeSum + element.size + if (this.fileSizeToMB(this.filesSizeSum) <= 20) { + console.log('pass size verificartion') + if (this.checkFileType.checkFileType(element.mimeType) == 'video' && this.platform.is('ios')) { + let resultUrl = decodeURIComponent(element.path); console.log('pass type verification ', resultUrl) + try { + this.recordevideoIos(resultUrl) + } catch (error) { + console.log('upload video error: ', error) + } + } else if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') { let resultUrl = decodeURIComponent(element.path); - console.log('pass type verification ', resultUrl) + console.log('pass type verification ', resultUrl) + try { + this.loadVideoAndroid(resultUrl,element) + } catch (error) { + console.log('upload video error: ', error) + } + } + } else { + if (this.seletedContent.length === 0) + this.filesSizeSum = 0 - try { - - if(this.platform.is('ios')) { - this.recordevideoIos(resultUrl) - } else { - this.loadVideoAndroid(resultUrl,element) - } - - } catch (error) { - console.log('upload video error: ', error) - } - - } - } else { - if (this.seletedContent.length === 0) - this.filesSizeSum = 0 - - this.httpErrorHandle.validationMessagge('filessize') - } - }); - }; + this.httpErrorHandle.validationMessagge('filessize') + } + }); + }; chossePhotoOrVideo() { diff --git a/src/app/services/attachments.service.ts b/src/app/services/attachments.service.ts index 9d973afd8..5179e0093 100644 --- a/src/app/services/attachments.service.ts +++ b/src/app/services/attachments.service.ts @@ -68,7 +68,7 @@ export class AttachmentsService { downloadFile(guid: any) { - let downloadUrl = environment.apiURL + 'objectserver/streamfiles?path=' + guid; + let downloadUrl = environment.apiURL + 'objectserver/StreamChatFiles?path=' + guid; var name = new Date().getTime(); return this.http.get(downloadUrl, { responseType: "arraybuffer",