Closed mvmn closed 3 years ago
Nevermind: turns out it's not helpful at all in detecting current playback position since framePos is not actually updated.
The best way, IMHO, to get the current playback position is to call dataLine.getMicrosecondPosition() - assuming you are playing your AudioInputStream with some sort of DataLine
.
If that's not an option, I'd recommend keeping track of how many frames you have already read form the AudioInputStream
and convert that to seconds. Unfortunately, because of buffer sizes, that will always be a little chunky.
Current dirty hack I've made is to read framePos from a PCM_SIGNED AudioInputStream stream that is converted from original AudioInputStream - via reflection :-(
As for dataLine.getMicrosecondPosition() - not sure how this will work with a seek.
As for dataLine.getMicrosecondPosition() - not sure how this will work with a seek.
You'd have to remember your current offset, whenever you seek.
Allow retrieving current playback position from FFAudioInputStream