I followed a simple tutorial to create a game using Phaser and I have modified all the files and directories to make it work with cordova so that it works on Android. The problem is the sound that plays on browser is not playing on phone. I read that I should use the cordova Media API so I added it but I get the error "Media is not defined" when running the game. This is the order in which I link to the js files in index.html:
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/phaser.min.js"></script>
<script type="text/javascript" src="js/index.js"></script>
I'm creating the audio variable in the preload function of phaser like so:
preload: function() {
var audio = new Media('/android_asset/www/img/assets/jump.wav');
}
And in the jump function:
jump: function() {
window.audio.play();
}
I can't understand what's the problem.