How to access the file saved in the externalDataDirectory Ionic4

I am trying to access the file I downloaded with fileTransfer plugin into the externalDataDirectory, I can see the file there from my file manager . When I console log the return full path of the file I am able to see something like this

file:///storage/emulated/0/Android/data/<my-app-id>/files/<my-files>

but then when I try to preload the file audio.native like this

      this.nativeAudio.preloadComplex('uniqueId', this.file.externalRootDirectory+`${myPath}`, 1, 1, 1).then(this.onPreloadSucess, this.onPreloadError);

I got a not found exception because a www was prepended to the path like this

www/file:///storage/emulated/0/Android/data/<my-app-id>/files/<my-files>

I also try to resolve the path, but got the same result.

How do I handle this.

You’re not likely to be super-happy with this answer, but I would suggest using neither of those plugins: replace file-transfer with ordinary HttpClient, and replace native-audio with Media.

File-transfer is EOLed and unnecessary these days, and native-audio only works with assets bundled into your app.

1 Like

Okay, thank you will have a look at that. just a clarification also, is zip plugin able to access external directory because that is also giving an issue

Documentation seems to suggest so; I’ve never used it.

1 Like

The problem I am facing with the Media plugin now is to create multiple instance of audio files dynamically

single instance looks like this

const file: MediaObject = this.media.create('file.mp3');

how do I create a dynamic variable of type MediaObject. Thanks as always

I would suggest creating a new topic, as things seem to have drifted rather significantly from the original one.

Thank you so much would do that

Thank you, done