Exposing currentTime of a sound object. Tried using the _startTime, _startOffset and engine's current time but some issues

Hey, I wanted to ask if it is possible to expose the currentTime of a Sound object. I read an advice that was provided before to use the startTime, with the startOffset and the engine’s current time to calculate it, at that is not fully working as expected.

Here is my code:

This works fine most of the time. However, when a sounds runs all the way to its end, when you replay the sound, the startOffset doesn’t go back to zero, and I start getting none expected currentTimes. I could listen to the end event on my side, but I think this is becoming a bit too hacky.

Would it be possible for this be calculated on Babylon’s side as it is a common property on media?

sure thing! wanna do a PR?

Sure, here it is:

I’m waiting for the checks to finish and I will gladly merge
Thanks a lot

1 Like