Play video in video tag

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

Found solution
visit Ionic Webview for details, and sample code is `this.camera.getPicture(options).then((imageData) => {

  let url = this.webview.convertFileSrc(imageData);
  let video = this.myVideo.nativeElement;
  video.src = url;
  video.play();`

If you are using cordova-plugin-ionic-webview, you can’t set the video src to a file url, you have to convert it to a proper url with convertFileSrc function https://ionicframework.com/docs/native/ionic-webview