i am using phonegap audio plugin in my phonegap app. I have some audio files stored in www/audio folder.
For android i used \"file:///android_asset/www/audio
Finally got it, reference:link
To get path i used this function
function getPhoneGapPath() {
var path = window.location.pathname;
path = path.substr( path, path.length - 10 );
return path;
};
For IOS:
var snd = new Media( getPhoneGapPath() + 'test.mp3' );
For Android:prepend 'file://'
var snd = new Media( 'file://' + getPhoneGapPath() + 'test.mp3' );
You will have trouble if called from a file other than 'index.html' because the part to trim off might not be 10 chars.
Try this:
// Get absolute file path on the device.
function getPhoneGapPath() {
var path = window.location.pathname;
var sizefilename = path.length - (path.lastIndexOf("/")+1);
path = path.substr( path, path.length - sizefilename );
return path;
};