Ionic 4: Video Upload Error

Hello there,

I’m developing an application using Ionic with Angular Framework. In my application, I need to capture a video and upload it to a server. For that, I’m using media-capture plugin for capturing video and file transfer plugin.

Here is the code that I’m using it for capturing and uploading it to a remote server:

// Capturing Video 
captureVideo() {
    let options: CaptureVideoOptions = { limit: 1 }
    this.mediaCapture.captureVideo(options)
      .then((videoData: MediaFile[]) => {
        var i, path, len;
        for (i = 0, len = videoData.length; i < len; i += 1) {
          path = videoData[i].fullPath;
        }
        this.videoPath = path;
        console.log(this.videoPath);
      })
      .catch((err: CaptureError) => err)
  }

// Uploading Video
uploadVideo() {

    var options: FileUploadOptions = {
      fileKey: "videos",
      fileName: 'sample.mp4',
      chunkedMode: false,
      mimeType: "video/mp4"
    }

    var params: any = {};
    params.typeOfItemGroup = "SPACE";
    params.itemGroupName = "Kitchen";
    options.params = params;

    console.log("options: ", options);

    this.videoFileUpload = this.fileTransfer.create();

    this.videoFileUpload.upload(this.videoPath, 'localhost:8081/api/v1/shield/camera/video/5e706f96b5587e5e6776614f', options)
      .then((data) => {
        console.log("Data: " + data);
      })
      .catch((err) => {
        console.log("Error in upload: ", err);
      });
  }

The Error I’m getting is:

I’m not able to figure it out the code: 2 error.

For Backend It’s working fine as below:

Any advice and suggestions will be greatly appreciated.

Thanks,
Karumuri