"Encoding_Err" form Cordova File Plugin


Hey everyone! I am having trouble uploading videos to my AWS S3 directly from my Typescript. I can upload text files perfectly fine so I am under the impression that my credentials and how I am uploading are fine, but i could be wrong. I am currently using the media-capture plugin to record a video through the camera and automatically upload it to my S3 bucket using the Javascript SDK, but my File.readAsArrayBuffer is giving me a “code”:5,“message”:“ENCODING_ERR” Any help with this would be greatly appreciated! I’m new to Ionic 2 so please don’t spare details.

    MediaCapture.captureVideo().then((data: MediaFile[]) => {

          File.readAsArrayBuffer(data[0].fullPath, data[0].name).then(
            (success) => {
              console.log("----Successfully read the file!---");
              this.uploadToS3(success); },
            (err) => {
              console.log("----File Reading Failed!----");
        (err) => {console.log(err)}

  uploadToS3(fileIn, nameIn){
      // let video = new Blob([file], {type: "video/quicktime"});

      var params = {Bucket: 'myBucket', Key: nameIn, Body: fileIn}; 
      this.s3.upload(params, function(err, data) {
        console.log("---S3 Upload----");
        console.log(err, data);

Note: The above code is just the relevant part of my ts file, I have all the appropriate imports and all the appropriate plugins have been installed.

Thank you!


Were you able to solve this? I am encountering this same problem.


any luck guys, I’m stuck here too


Make sure your URI is correctly formatted. If not you can append the necessary missing parts.


The URI returned from the MediaCapture plugin on android is:
and the camera plugin returns: /storage/emulated/0/DCIM/Camera/VID_20170616_062334.mp4
And it runs perfectly on the html 5 video player. But the File plugin is causing issuses.
Can you please specify that what is the correct format of the URI to pass to the file plugin?


It should have file:/// with the path. The returned /storage/emulated… is not in proper format so you have to add file: in it.