This commit is contained in:
Eudes Inácio
2023-10-31 15:13:19 +01:00
parent 4801ea2210
commit f7b6f20eaf
@@ -207,12 +207,12 @@ export class NewPublicationPage implements OnInit {
this.video = data[0]; this.video = data[0];
console.log(this.video) console.log(this.video)
this.fileType = "video/mp4" this.fileType = "video/mp4"
let resultUrl = decodeURIComponent(data[0].fullPath); let resultUrl = decodeURIComponent(data[0].localURL);
Filesystem.readFile({ path: resultUrl }) Filesystem.readFile({ path: resultUrl })
.then(async (content) => { .then(async (content) => {
console.log(content) console.log(content)
this.capturedVideo = content.data; this.capturedVideo = "data:video/mp4;base64," + content.data;
this.photoOrVideo = false; this.photoOrVideo = false;
}) })
.catch((err) => console.error(err)); .catch((err) => console.error(err));
@@ -225,7 +225,8 @@ export class NewPublicationPage implements OnInit {
async loadVideo() { async loadVideo() {
const result = await FilePicker.pickVideos({ const result = await FilePicker.pickMedia
({
multiple: true, multiple: true,
}); });
let resultUrl = decodeURIComponent(result.files[0].path); let resultUrl = decodeURIComponent(result.files[0].path);
@@ -235,9 +236,11 @@ export class NewPublicationPage implements OnInit {
.then(async (content) => { .then(async (content) => {
console.log(result) console.log(result)
console.log(content) 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)); .catch((err) => console.error(err));
}; };