Using ionic 2 with Typescript I could capture video with the following code:
takeVideo() {
let data: Array<any> = this.MediaFile;
let options = {
limit: 1,
duration: 15,
type: "video/mp4",
height: 100,
width: 120,
quality: 1
};
MediaCapture.captureVideo(options)
.then((MediaFile) => { this.MediaFile[0] = "data:video/mp4" + MediaFile;
console.log(MediaFile);
let i, path, len;
for (i = 0, len = data.length; i < len; i += 1) {
console.log(path);
// How do I display this video to the user?
this.videoFilePath = MediaFile[0].fullPath;
}
},
(err) => {
console.error(err);
}
);
}
But I could not display the captured video to enable the user to preview the captured video. Meanwhile, the captured video is always saved in the phone. I was trying the following code in home.html to display the captured video with it:
<video width="320" height="240" id="resource-video" controls="controls" autoplay="false"
[src]="MediaFile" *ngIf="MediaFile">
</video>
I do not know what else to do to get the captured video displayed. Please I'm eagerly seeking for a way to have it done. Kindly assist me if you could. Thanks.