I am trying to pause and play an audio which was started with an offset. Instead of resuming from the position that it was paused, the audio restarts from the beginning. Repro is added in the playground below. The pause/play is done inside the onPointerUpObservable of the Issue button. After pausing and playing, I would expect the audio to resume at around 10 seconds. But instead, the audio restarts from 0 seconds
The issue seems to be coming from this line which doesn’t consider the current offset when assigning the _startOffset and this line which also ignores the offset if isPaused is true.
@docEdub Thanks a lot for the super fast response and fix. The pause / play seems to be working now. However, I now seem to be getting a new issue. When I try to restart an audio by calling play(0, 0) on a sound which has previously been started with an offset, it is not starting from 0 but from the previous offset. The relevant code and playground are added below
sound.play(0, 0) // I would expect this to start from 0, but it is starting from 10
I don’t know if this is expected or not, but it doesn’t make sense to me that stopping while paused makes currentTime return a different value than stopping while not paused. I would expect the stop function to reset any state related to pause and always reset currentTime to zero.
@docEdub Apologies for the repeated posts, but I just checked the v5.43.0 release and think I’m getting into another issue. In the latest release, the currentTime after pausing an audio is always returning 0