oto: add a function to get the player's current position
I am trying to write a music player using oto.
I know how long a track is based on the number of samples and the sample rate.
However, during playback I want to be able to show progress, for which a Player.Position() int64 is needed.
You can use Seek(0, io.SeekCurrent)
I tried it but it doesn't work inside the isPlaying loop.
Try running oaplay
with an ogg audio file, e.g., go run . /path/to/track.ogg
https://github.com/hajimehoshi/ebiten/blob/6f5fab47aa8780ec69d4687588a121aae54139de/audio/player.go#L253
Ebitengine already does that. You would have to consider buffer size actually.
EDIT: Ebitengine manages its position by itself. In theory you can do the same thing, but I admit this might be troublesome.
I've worked around it by capturing the duration and start time and using time.Since() to give me the position during IsPlaying.
Let me reopen this. I might add Position later.