[SOLVED] Looping Sound Not Stopping

Hi,
I am trying to stop looping BG music and play another one but the previous one is not being stopped by
" this.entity.sound.stop(‘SoundName’); " hence overlapping the multiple music.

Does anyone know about it?
Thanks

Do you mean not being stopped?

I have created the exact same scenario in a test project where I am playing the relevant BG music when browser window gets focus but it is working as it should in this case.

https://playcanvas.com/editor/scene/1447711

Thanks for the help.
The issue is resolved.

The sequence of my code was

“-Browser Tab = > Out of focus
-Game Paused
-Paused Music Played and Menu Music Stopped
-Browser Tab = > Got focus
-Game resumed
-Menu Music Played and Pause Music Stopped”

And this sequence was overlapping both Pause and Menu BG Music. I stopped playing the Pause Music while tab is going out of focus and it started to work fine now.

Thanks

1 Like