Jump to content

Sound accumulation when game not focused


NoxBrutalis
 Share

Recommended Posts

Hey everyone, It seems that sounds are accumulating when  the game isn't focused. So when i click to another page for example, the sound of the game mutes, but when i click back to the game all the sounds that happened while it was muted seem to play all at once.

Before this I think I was making it worse by not having sounds assigned to variables. So originally I was doing this whenever I needed a sound to play :

 

this.scene.sound.play('sound');

 

the sound seems to be more consistent now that I also assign the sound to a variable and call play on the variable instead:

 

this.sound_gunshot = this.scene.sound.add('gunshot') // gunshot already this.audio.load -ed

this.sound_gunshot.play();

 

However, the problem still stands regarding sounds not being consumed when the game isn't focused. Any ideas about this?
Thanks in advance for your time.

 

EDIT - sorry I dont think this is actually an issue. Either it was just needing to change the way the sound was played, like above, or it was that I was using game.sound.add in one place instead of scene.sound.add. Either way I can't say that the problem is noticeable. Feel free to delete the post (don't think I can myself).

Edited by NoxBrutalis
solved
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...