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.

This commit is contained in:
neviyn 2016-02-29 03:33:44 +00:00
parent 97f8e52a16
commit ba951541b6

View File

@ -73,7 +73,7 @@ class Player {
playBin.play(); playBin.play();
thread.start(); thread.start();
while (true) { while (true) {
if (playBin.isPlaying()) break; if (playBin.queryDuration().getNanoSeconds() > 0) break;
} // Wait for song to actually be playing otherwise queryDuration is always zero } // Wait for song to actually be playing otherwise queryDuration is always zero
callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds()); callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds());
} }