Path to local media for $cordovaMedia

I’m struggling with specifying a proper path to the local media file for $cordovaMedia on android. $cordovaMedia.newMedia(src).play() works. But only if src is an absolute url. Be it an external site or ionic one.

Try as I may I can’t figure out the right url for ‘www/demo.mp3’. ‘/www/demo.mp3’, ‘file://www/demo.mp3’, ‘android_asset/www/demo.mp3’, ‘file://android_assets/www/demo.mp3’. Just a few examples of dozens of variations I tried so far.

Hi @qexx,

What happens if you do something like this:

var filePath = cordova.file.applicationDirectory + “mp3/sound.mp3”;

The above line should play a song found in your www/mp3/ directory.

Regards,

Hi there!
How to scan all folders on SDcard and phone to MP3 files and make an playable list ?