video on publication

This commit is contained in:
Eudes Inácio
2023-11-06 16:28:10 +01:00
parent 448092677b
commit 2203713d08
@@ -205,10 +205,9 @@ export class NewPublicationPage implements OnInit {
async startVideoRecording() {
try {
let options: CaptureImageOptions = { limit: 1 }
let result: any
result = await this.mediaCapture.captureVideo(options)
this.video = result[0];
console.log(this.video)
const data = await this.mediaCapture.captureVideo(options)
this.video = data[0];
/* console.log(this.video)
if (result && result.length > 0) {
const videoFile = result[0];
const copiedVideoPath = await this.copyVideoToDataDirectory(videoFile);
@@ -217,19 +216,20 @@ export class NewPublicationPage implements OnInit {
const base64Video = await this.convertVideoToBase64(copiedVideoPath);
console.log(base64Video);
}
}
} */
/* this.convertVideoToBase64(data[0].fullPath) */
/* this.fileType = "video/mp4"
this.fileType = "video/mp4"
await Filesystem.writeFile({
path: data[0].name,
data: data[0].fullPath,
directory: Directory.Data,
}).then((dir) => {
directory: FilesystemDirectory.Data,
}).then(async (dir) => {
console.log('DIR ', dir)
let resultUrl = decodeURIComponent(dir.uri);
const base64Video = await this.convertVideoToBase64(dir.uri);
/* let resultUrl = decodeURIComponent(dir.uri);
Filesystem.readFile({ path: resultUrl, encoding: Encoding.UTF8, })
.then(async (content) => {
@@ -237,12 +237,12 @@ export class NewPublicationPage implements OnInit {
const base64Data = btoa(content.data);
console.log(base64Data);
/* this.filecontent = true;
this.filecontent = true;
this.capturedVideo = "data:video/mp4;base64," + content.data;
this.photoOrVideo = false;
})
.catch((err) => console.error(err));
}); */
.catch((err) => console.error(err)); */
});
} catch (error) {
console.log('record video error: ', error)