Hi,
I am facing an issue that, i want to get video form gallery and play it in video tag,
<ion-content>
<ion-button (click)="addVideo()">Play Video</ion-button>
<video controls autoplay #myvideo>
</video>
</ion-content>
I am getting video from camera plugin and error is that it isn’t working in video tag
@ViewChild('myvideo') myVideo: any;
async addVideo(){
const options: CameraOptions = {
quality: 100,
sourceType : this.camera.PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.VIDEO
}
this.camera.getPicture(options).then((imageData) => {
let url = imageData;
let video = this.myVideo.nativeElement;
video.src = url;
video.play();
}, (err) => {
alert(err)
console.error(err);
});
}
Here is my complete code,
Thanks