I'm developing an ionic app, where user can record a new video. Then I want to break the video into frames and send frames to a server. I'm using createThumbnail
function from ionic-native
VideoEditor
plugin. But when I try to call createThumbnail
function, it throws
ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function
Here's my source code.
HTML Code
<ion-content padding>
<button ion-button full (click)="captureVideo()">Capture video</button>
<br/>
<ion-list>
<ion-item *ngFor="let file of mediaFiles" tappable (click)="playFile(file)" text-wrap>
{{file.name}}
<p>{{file.size/1000/1000 | number}} MB</p>
</ion-item>
</ion-list>
<video controls autoplay #myvideo></video>
</ion-content>
TypeScript Code
captureVideo() {
let options: CaptureVideoOptions = {
limit: 1,
duration: 30
}
this.mediaCapture.captureVideo(options).then((res: MediaFile[]) => {
let videoData = JSON.stringify(res);
let res1 = JSON.parse(videoData);
this.videoURL = res1[0]['fullPath'];
let video = this.myvideo.nativeElement;
video.src = this.videoURL;
video.play();
var option: CreateThumbnailOptions = {
fileUri: res[0].fullPath,
outputFileName: 'aaaa',
atTime: 2,
width: 320,
height: 480,
quality: 100
};
console.log("option :" ,option);
this.videoEditor.createThumbnail(option).then(res=>{
console.log('Thumbnail result: ' + res);
}).catch(err=>{
console.log("ERROR ERROR", err)
});
}, (err) => {
console.log("ERROR", "error selecting video");
});
}
Can someone help me with, why I'm getting such error?