Access to mp3 file in assets/ directory via Filesystem?

#1

My app needs to play an mp3 file stored in the assets/ directory of my project.

The code to play the file is super simple:

this.file = this.media.create(theSoundFileURI);
this.file.play();

where this.media is the ionic-native/media module.

This code works when I play an mp3 file found on the internet – like https://etc/blah/blah.mp3. But, when I feed it a URI like file:///assets/sound.mp3 it does not work.

I suspect I am just not providing the correct URI. Can the Capacitor Filesystem module help me?

Thanks.

0 Likes