Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Geert

I've been reading ImpactJS discourages using sound on mobile devices. But is it possible to use some basic audio with ImpactJS anyway?

I was wondering if it should work if you don't disable it. At this moment I'm not getting any audio on mobile, and I haven't explicitly disabled it.

10 years ago by xukaifrog

I was having the same problem too, it is very strange.
My mobile browser can play audio, below code works fine:
var player = new Audio(PATH);
player.play();

But when I inserted this code into my impactjs project, it stops working....
handleMovementTrace: function( res ) {
if( res.collision.y && this.vel.y > 32 ) {
//this.sound.play();
insert code here is no working
}
this.parent(res);
},

10 years ago by Gregory

Mobile on sound is a pita to work with. I think the only way to get audio to work properly is to load it after you get a 'touchstart' event.

So for me. I load the minimum assets needed to show the title screen with a play button. When the user touches the screen to press the button, it should also be the same time you get the 'touchstart' event. In that even you load all the audio resources and the rest of the game assets.

So after you show the title screen, show the loading screen, then show the game's home/level select menu. On desktop you swap the loading screen and title screen.

Make sense?
Page 1 of 1
« first « previous next › last »