You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
or provide this feature:
Lets say we have following sound: this.curLoadedMusicTrack = this.audioScene.sound.add(trackData.key, trackData.soundConfig); and the scene audio is unlocked (Phaser.Sound.Events.UNLOCKED).
Then if for example App music is set to 'muted' and we call: this.curLoadedMusicTrack.pause()
and later we decide to unpause, and call: this.curLoadedMusicTrack.resume()
Then the curLoadedMusicTrack will not play any music. However, when we call play() before we call pause(), like this: this.curLoadedMusicTrack.play(); this.curLoadedMusicTrack.pause() this.curLoadedMusicTrack.resume()
Then all works fine, the music plays.
The idea is to be able to play music by simply calling pause() and resume() on loaded track, not having to call play(), or is there a simpler way to do this i'm missing? Please advise. Looking back, this might be a pointless thing to ask for (its so minute), however it took me a while to realize, what is going on - why my music is not playing in specific case of music muted on start.
Thank you!
The text was updated successfully, but these errors were encountered:
Only playing sounds can be paused, and only paused sounds can be resumed. There's no need to pause a sound that's just been added.
If you want to control playback only through pause() and resume() then I guess you should do play().pause() immediately after adding, as you've discovered.
The idea is to update documentation here:
https://newdocs.phaser.io/docs/3.55.2/Phaser.Sound.BaseSound#resume
or provide this feature:
Lets say we have following sound:
this.curLoadedMusicTrack = this.audioScene.sound.add(trackData.key, trackData.soundConfig);
and the scene audio is unlocked (Phaser.Sound.Events.UNLOCKED).Then if for example App music is set to 'muted' and we call:
this.curLoadedMusicTrack.pause()
and later we decide to unpause, and call:
this.curLoadedMusicTrack.resume()
Then the
curLoadedMusicTrack
will not play any music. However, when we callplay()
before we callpause()
, like this:this.curLoadedMusicTrack.play(); this.curLoadedMusicTrack.pause() this.curLoadedMusicTrack.resume()
Then all works fine, the music plays.
The idea is to be able to play music by simply calling
pause()
andresume()
on loaded track, not having to callplay()
, or is there a simpler way to do this i'm missing? Please advise. Looking back, this might be a pointless thing to ask for (its so minute), however it took me a while to realize, what is going on - why my music is not playing in specific case of music muted on start.Thank you!
The text was updated successfully, but these errors were encountered: