From ba951541b6cd1cc1bd3eb8583fad8ce5951d9b4e Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Mon, 29 Feb 2016 03:33:44 +0000 Subject: [PATCH] Changed wait requirement for setting seekbar maximum value. GStreamer needs to load the file before we can know its duration and previously it might not wait long enough for that data to populate. --- src/main/java/musicplayer/Player.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/musicplayer/Player.java b/src/main/java/musicplayer/Player.java index d371005..256a75a 100644 --- a/src/main/java/musicplayer/Player.java +++ b/src/main/java/musicplayer/Player.java @@ -73,7 +73,7 @@ class Player { playBin.play(); thread.start(); while (true) { - if (playBin.isPlaying()) break; + if (playBin.queryDuration().getNanoSeconds() > 0) break; } // Wait for song to actually be playing otherwise queryDuration is always zero callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds()); }