I run the game in Cordova an I see this
This error only appears when I run the game on cordova with WebAudio
I run the game in Cordova an I see this
Do you do anything before the error? It suggests the Web Audio context is missing, which is strange.
I think there is a function that could be interfering
footstep: function () {
/*
var tilesAtXY = game.map.ground.getTiles(x*32,y*32,31,31);
for(var i=0;i<tilesAtXY.length;i++){
var myTile = tilesAtXY[i];
if(myTile.index!=8006){
y = null;
}
}
*/
var type = game.map.properties.footstep;
if (type == "GrassRun") {
playStep("steps_GrassRun");
}
else if (type == "Grass") {
playStep("steps_GrassRun");
}
else if (type == "Forest") {
playStep("steps_Forest"+r(2));
}
else if (type == "GravelRun") {
playStep("steps_GravelRun");
}
else if (type == "Gravel") {
playStep("steps_Gravel1");
}
else if (type == "Sand") {
playStep("steps_Sand");
}
else if (type == "Snow") {
playStep("steps_Snow");
}
},
that function is called on update when PLAYER.isWalking == true
and every time I walk that happens.
It only happens when I use WebAudio and Cordova together.
It doesn’t bug when I use TagAudio and Cordova. Neither if you don’t run in cordova
What is in playStep()
?
function playStep(key) {
if (PLAYER.footstep == null) {
PLAYER.footstep = game.add.audio(key);
PLAYER.footstep.playOnce = true;
PLAYER.footstep.loop = false;
PLAYER.footstep.volume = 0.2;
PLAYER.footstep.allowMultiple = false;
} else if (!PLAYER.footstep.isPlaying) {
PLAYER.footstep.play();
}
}
This will delete the sound once playback is complete. That’s probably causing the error after play()
.