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 }