I am trying to play a wav file from my PG application and it works properly on the iPhone.
I have read all the following: audio not working with phoneGap How to play song in Android - phonegap Playing local sound in phonegap
I am using PGB to compile my app and its using PG 1.7.0.
I just can figure out how to make it play :(
I tried using
function getPhoneGapPath() {
var path = window.location.pathname;
path = path.substr( path, path.length - 10 );
return 'file://' + path;
};
var pathToCheerFile=getPhoneGapPath()+ 'sounds/cheer.wav';
console.log('pathToCheerFile=',pathToCheerFile);
return new Media(pathToCheerFile,
// success callback
function() {
console.log("cheer Audio loaded Success");
},
// error callback
function(err) {
console.log("cheer Audio load Error: " , err);
},
);
The console is showing pathToCheerFile=file:///android_asset/www/sounds/cheer.wav
and later it shows cheer Audio load Error:
with err being an object that has a single property code:1
.
any ideas on what am I doing wrong ?