Fixed play button sticking for certain songs on start due to waiting for duration availability.
This commit is contained in:
parent
8b3bc16f52
commit
ea23faa16c
@ -45,7 +45,7 @@ final class LibraryUtils {
|
|||||||
});
|
});
|
||||||
if(callbacksEnabled)
|
if(callbacksEnabled)
|
||||||
callbackInterface.libraryUpdated(true);
|
callbackInterface.libraryUpdated(true);
|
||||||
});
|
}, "libraryUpdater");
|
||||||
updaterThread.start();
|
updaterThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,12 +68,12 @@ class Player {
|
|||||||
}
|
}
|
||||||
playBin.setURI(songFile.toURI());
|
playBin.setURI(songFile.toURI());
|
||||||
internalThread = new InternalThread();
|
internalThread = new InternalThread();
|
||||||
thread = new Thread(internalThread);
|
thread = new Thread(internalThread, "GSTThread");
|
||||||
setVolume(currentVolume);
|
setVolume(currentVolume);
|
||||||
playBin.play();
|
playBin.play();
|
||||||
thread.start();
|
thread.start();
|
||||||
while (true) {
|
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
|
} // Wait for song to actually be playing otherwise queryDuration is always zero
|
||||||
callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds());
|
callbackInterface.setSeekBarDuration((int) playBin.queryDuration().toSeconds());
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
|
|||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}, "seekbar");
|
||||||
seekBarUpdater.start();
|
seekBarUpdater.start();
|
||||||
refreshLibrary();
|
refreshLibrary();
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ public class PlayerGUI implements PlayerCallbackInterface, LibraryCallbackInterf
|
|||||||
addNodeToTreeModel(failedModel, failedParentNode, failedNode);
|
addNodeToTreeModel(failedModel, failedParentNode, failedNode);
|
||||||
libraryView.setModel(failedModel);
|
libraryView.setModel(failedModel);
|
||||||
}
|
}
|
||||||
});
|
}, "libraryRefresh");
|
||||||
populateThread.start();
|
populateThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user