Get size of selected video file with cordova camera plugin. "getMetadat" does not work with the file url

I am trying to get the size of a file selected with the cordova camera plugin. I have got this code to read the video library of the device.

var options = { 
    destinationType: Camera.DestinationType.FILE_URI,
    sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
    function(imageURI) {
        $scope.form_data.videofile  =   "file://" + imageURI;

        var entry = new FileEntry('video1', $scope.form_data.videofile);
            function (metadata) {
                console.log("Last Modified: " + metadata.modificationTime);
            function (error) {
                alert(error.code); // GOT ERROR NUMBER 5
    function(message) {
        alert('Failed because: ' + message);
    }, options);    

I tried with this two path:

  1. “file://” + imageURI
  2. imageURI

In both cases I obtain error code number 5, wich is FileError.ENCODING_ERR according this documentation. The error code means that the url is malformed, but I upload the video file with that url (“file//” + imageURI).

Any ideas of this? Thank you.

1 Like

Did you solve this one? I’m having the same issue.

Also having this issue, were you able to solve this?

Did you solve this? Also have the issue.

How can get size and modificationTime when in function use file.getMetadata(…)?
size and time return 0 and null.

    this.file.listDir(this.path,'files').then((files:any) =>{>{
	    let Fsize=0;
	    let modifydate= '';
 	    val.getMetadata(function (metadata){}).then(meta => {
	        Fsize= meta.size; // Get file size.
		modifydate = meta.modificationTime;
                path : val.nativeURL,
	        modifydate: modifydate,//can not get value
	        Fsize: Fsize //can not get value
      }).catch(error=> console.log(JSON.stringify(error)));

Please help me. Thanks so much.