Minim AudioPlayer.length() outputs wrong value

Hey all,

I was working on a little audio visualizer project today using the Minim library, and I ran into a small issue with the AudioPlayer class. The project requires a class that can load, play, and analyze an audio file in real time, and I added playback control methods, one of which being a toggle pause method which will also restart playback from the beginning if called when playback is finished. To detect when it needs to do this, I have an if statement that uses AudioPlayer.rewind() if AudioPlayer.position() == AudioPlayer.length(), but it seems with some files that playback finishes with a discrepancy of a couple hundred milliseconds between the two, so the if statement doesn’t execute and playback doesn’t restart.
The function looks like this:

AudioPlayer player;
...
public void togglePlay() {
    if(player != null) {
      if(playing()) {
        player.pause();
      } else {
        if(player.position() == player.length()) {
          player.rewind();
        }
        /*
        Print statement for debugging.
        Consistently says player.position() is 193933 and player.length() is 194220 when playback has finished.
        */
        println("Play", player.position(), player.length());
        player.play();
      }
    }
  }

Curiously, the AudioPlayer.skip() method will not allow me to skip past 193933ms. The documentation for that method says if the skip would put you past the length, it’ll clamp it to the length, which leads me to believe that either length or position is somehow outputting the wrong number.
If anyone has any input, be it a solution, advice, or discussion, I’d much appreciate it.

Thanks.