Gameventions Posted February 17, 2015 Share Posted February 17, 2015 So I have some cut scenes in my game that have simple audio and events tied to the timer to display animations on the screen. The problem is when i click off the browser, the animation time stops, but the sound loop while it stops 'playing' keeps progressing. So basically start cut scene timers in sinc. At 5 seconds i click onto another window. wait 5 seconds and click back on the game, sound will be at 10 seconds, but the animation at 5. Anyway to make sure these sync up whether people click off the window or not? Link to comment Share on other sites More sharing options...
Henryk Posted March 17, 2015 Share Posted March 17, 2015 You can check for the onBlur and onFocus Event and pause/unpause the current running sounds. create: function(){ this.game.onBlur.add(this.onInactive, this); this.game.onBlur.add(this.onResume, this); }, onInactive: function(){ console.log('now is inactive'); // now pause all the running sound this.game.sound.pauseAll(); }, onResume: function(){ console.log('now resume'); // now resume all the running sound this.game.sound.resumeAll(); },I did not try it. I was just looking things up in the docs. But the principle should work.. BrunoHautenfaust 1 Link to comment Share on other sites More sharing options...
Recommended Posts