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 Husten

hi,

everthing work fine, but now i ve added a few soundeffects. it works fine on ie, firefox and chrome.

but when it has to play a sound, the current safari on mac crashs! no error, nothing, it simple ends or on another mac the safari restart and load the page again. testet on 3 macs and in a virtual maschine.

i simple use

this.soundKick = new ig.Sound('sound/hero/kick.*');

and later

this.soundKick.play();

i have ogg and mp3 for alll sounds. any idea? my client is pissed :)

1 decade ago by Husten

playbiolab.com has the same problem :( it crashs after loading.

1 decade ago by Joncom

If the official demo is not working for you it's safe to assume that it's Impactjs and not your code. Unfortunately HTML5 w/ sound is not perfect. Maybe tell your client to get a better browser in the meantime? Hehe...

1 decade ago by Husten

the solution now is that i detect the safari and play the sound for safari with soundmanager :) for all with the problem

detect safari on start

window.is_safari = 0;
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
window.is_safari = 1;
}

and than init a sound

if (window.is_safari == 1) {
soundManager.play('kick');
} else {
this.soundKick.play();
}

and then play it

if (window.is_safari == 1) {
soundManager.play('kick');
} else {
this.soundKick.play();
}

or you write a global function to play a sound and in this function you check for safari. its easy :)

urlsoundmanager: http://www.schillmania.com/projects/soundmanager2/

1 decade ago by dmen

Any reason not to just use SoundManager for everything?

1 decade ago by tarrent

I've tried SoundManager for iOS and it works fine, sounds are played... except that it has 10~20 seconds gap before playing the next sound, if you're using many sound files. I think audio isn't cached in safari even after it has been played, so therefore there's the 10~20 seconds lag time.

Maybe soundmanager is good if you're only using one sound file but in the case of many sound files, I find it best to combine all of them into a single sprite sheet, preload this into an <audio> element then cycle through its tracks.

1 decade ago by dmen

>>I find it best to combine all of them into a single sprite sheet, preload this into an <audio> element then cycle through its tracks.

Can you expand on that a little? Currently Safari doesn't do anything with the game I'm developing, crashing with an error in audio.js of the Impact library.
Page 1 of 1
« first « previous next › last »