Fixed play button sticking for certain songs on start due to waiting for duration availability.

This commit is contained in:
neviyn 2016-03-07 15:53:03 +00:00
parent 8b3bc16f52
commit ea23faa16c
3 changed files with 5 additions and 5 deletions

View File

@ -45,7 +45,7 @@ final class LibraryUtils {
});
if(callbacksEnabled)
callbackInterface.libraryUpdated(true);
});
}, "libraryUpdater");
updaterThread.start();
}

View File

@ -68,12 +68,12 @@ class Player {
}
playBin.setURI(songFile.toURI());
internalThread = new InternalThread();
thread = new Thread(internalThread);
thread = new Thread(internalThread, "GSTThread");
setVolume(currentVolume);
playBin.play();
thread.start();
while (true) {
if (playBin.queryDuration().getNanoSeconds() > 0) break;
if (playBin.queryDuration().getSeconds() > 0 || playBin.queryDuration().getNanoSeconds() > 0) break;
} // Wait for song to actually be playing otherwise queryDuration is always zero
callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds());
}

View File

@ -51,7 +51,7 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
running = false;
}
}
});
}, "seekbar");
seekBarUpdater.start();
refreshLibrary();
}
@ -202,7 +202,7 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
addNodeToTreeModel(failedModel, failedParentNode, failedNode);
libraryView.setModel(failedModel);
}
});
}, "libraryRefresh");
populateThread.start();
}