I've developed file reader in phonegap with following path:
var defaultPath = 'file:///storage/sdcard0/';
So i'm able to list all file on sdcard and select one folder with audio files to load. So my list of audio files looks like:
i[1] = 'file:///storage/sdcard0/Download/audio/file.mp3';
i[2] = 'file:///storage/sdcard0/Download/audio/file1.mp3';
Then I try to init song using Media plugin ( installed ) with following piece of code:
var media = new Media(i[1]);
media.play();
But audio does not play or do nothing. But when I'm trying to test it using PhoneGap APP all works fine this just isn't work when I make build and try to test app from build.
I found the issue by myself. Android does not let read files on local storage or on sdcard via path starting from root
/storage/sdcard0
/storage/sdcard1
. So when we would like to access local storage or sdcard we must access it viafile:///mnt/sdcard/
for sdcard andfile:///mnt/storage/sdcard1/
for phone storage.Small example how to read entries from sdcard or phone storage:
Hope that this will help with same issue as I had because this is not documented in phonegap.