Hello,
I’m having a setup where I need to loop my audio, but cannot do loop:true
in the Sound
constructor due to a few constraints. So, I’m looping the audio by calling sound.play()
inside sound.onEndedObservable
. However, in this scenario, the currentTime
seems to be exceeding the total duration of the sound when the below steps are followed:
- Start the sound with
sound.play()
- Wait for some time
- Pause it with
sound.pause()
- Call
sound.play()
- Let the current loop play
- Check
sound.currentTime
in the next loop. The value exceedssound.getAudioBuffer().duration
towards the end
PG:
PG Repro steps:
- Open the PG and allow the sound to play for some time (Preferably wait till the Current Time > 5 sec)
- Click on the
Pause-Play
button - Wait for the next loop.
sound.currentTime
will exceedsound.getAudioBuffer().duration
towards the end of the loop. The green box on the right will become red when that happens
It seems to be happening because _currentTime is not being set to zero when the audio loops