From f7b6f20eafed784b3e891b5b0cb11e7ed24926bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Tue, 31 Oct 2023 15:13:19 +0100 Subject: [PATCH] bug fix --- .../new-publication/new-publication.page.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 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 422b175ca..350b30187 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -174,7 +174,7 @@ export class NewPublicationPage implements OnInit { console.log('taked: ', picture) this.capturedImage = picture this.photoOrVideo = false; - + }); } @@ -207,12 +207,12 @@ export class NewPublicationPage implements OnInit { this.video = data[0]; console.log(this.video) this.fileType = "video/mp4" - let resultUrl = decodeURIComponent(data[0].fullPath); + let resultUrl = decodeURIComponent(data[0].localURL); Filesystem.readFile({ path: resultUrl }) .then(async (content) => { console.log(content) - this.capturedVideo = content.data; + this.capturedVideo = "data:video/mp4;base64," + content.data; this.photoOrVideo = false; }) .catch((err) => console.error(err)); @@ -225,7 +225,8 @@ export class NewPublicationPage implements OnInit { async loadVideo() { - const result = await FilePicker.pickVideos({ + const result = await FilePicker.pickMedia + ({ multiple: true, }); let resultUrl = decodeURIComponent(result.files[0].path); @@ -235,16 +236,18 @@ export class NewPublicationPage implements OnInit { .then(async (content) => { console.log(result) console.log(content) - this.capturedVideo = content.data; - - + if (this.fileType == "video/mp4") { + this.capturedVideo = "data:video/mp4;base64," +content.data; + } else if (this.fileType == "image/jpg") { + this.capturedVideo = "data:image/jpg;base64," +content.data; + } }) .catch((err) => console.error(err)); }; chossePhotoOrVideo() { - this.photoOrVideo = !this.photoOrVideo + this.photoOrVideo = !this.photoOrVideo }