Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70904

Check media file exists

$
0
0

@Gesti wrote:

Hello
I’m using ionic v3.

I download and save an audio file

this.file.writeFile(this.file.externalDataDirectory, fileName, xhr.response, { replace: true })
                .then(success => {
                  audio = this.media.create(success.nativeURL.replace(/file:\/\//g, ''));
                  audio.play();
                }, function (error) {
                  console.log("KO");
                });
            }

But when check if the file exsits I get only error status code 5, ENCODING_ERR:

let filePath = this.file.externalDataDirectory + fileName;
    let path = this.file.externalDataDirectory.replace(/file:\/\//g, '');

    console.log(path + fileName);
    this.file.resolveLocalFilesystemUrl(path + fileName)
      .then(res => {
 console.log("OK"
      }).catch(err => {
console.log("KO")}

Where I’m wrong?
I expect an NOT_FOUND_ERR, not and ENCODING_ERR

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70904

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>