jbavari / cordova-plugin-video-editor

A cordova plugin to edit videos.
Other
289 stars 235 forks source link

Can't read file #174

Open Rodrigo4ever opened 3 years ago

Rodrigo4ever commented 3 years ago

I'm not able to edit the captured video.

My code:

captureVideo2(){
    this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE)
        .then(status => {
            if (status.hasPermission) 
            {
              this.captureVideoOther();
            } 
            else 
            {
              this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.WRITE_EXTERNAL_STORAGE)
              .then(status =>{
                if(status.hasPermission) {
                  this.captureVideoOther();
                }                          
              });
            }
        })
        .catch((error) => { console.log(error)})     
  }
captureVideoOther(){
    console.log("captureVideoOther");
    let options: CaptureVideoOptions = {limit: 1, quality: 1, duration: 30 };

      this.mediaCapture.captureVideo(options)
          .then( 
                (data: MediaFile[]) => {               
                console.log(data);
                this.editVideoCaptured(data);            
                this.videoGravado = true;
            },
            (err: CaptureError) => console.error(err)
          )
          .catch((error:any) => console.log('erro', error))   

  }
  editVideoCaptured(urlvideo){
    this.videoEditor.transcodeVideo({
      fileUri: urlvideo[0].fullPath,
      outputFileName: 'output-mobile',
      outputFileType: this.videoEditor.OutputFileType.MPEG4,
      saveToLibrary: false,
      deleteInputFile: true,    
      maintainAspectRatio: true,
      width: 640,                 
      height: 360,             
    })
    .then((fileUri: string) => console.log('Video Transcode success', fileUri))
    .catch((error:any) => console.log('video transcode erro', error))   
  }

ERRO in CONSOLE:

video transcode erro java.io.IOException: can't read file: file:///storage/1E34-1801/DCIM/Camera/VID_20210720_152112.mp4 -> /storage/1E34-1801/DCIM/Camera/VID_20210720_152112.mp4

lloydllim commented 2 years ago

I got the same problem , I even added the WRITE_EXTERNAL_STORAGE androidPermission during run time , and still didnt work

lloydllim commented 2 years ago

did you manage to find a workaround regarding the issue ?