Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Nov 12, 2018
1 parent d782545 commit 92d8a27
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/librespot/spotify/player/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ private void loadTrack(boolean play, int pos) throws IOException, MercuryClient.
Metadata.Track track = session.mercury().requestSync(MercuryRequests.getTrack(new TrackId(ref)));
track = pickAlternativeIfNecessary(track);
if (track == null) {
LOGGER.fatal("Couldn't find playable track: " + ref.getGid());
LOGGER.fatal("Couldn't find playable track: " + Utils.bytesToHex(ref.getGid()));
state.setStatus(Spirc.PlayStatus.kPlayStatusStop);
return;
}

Expand Down Expand Up @@ -257,12 +258,12 @@ private void loadTrack(boolean play, int pos) throws IOException, MercuryClient.
playerRunner = new PlayerRunner(audioStreaming, normalizationData, spirc.deviceState(), conf, this, track.getDuration());
new Thread(playerRunner).start();

playerRunner.seek(pos);

if (play) {
state.setStatus(Spirc.PlayStatus.kPlayStatusLoading);
playerRunner.seek(pos);
playerRunner.play();
} else {
playerRunner.seek(pos);
state.setStatus(Spirc.PlayStatus.kPlayStatusPause);
}
} catch (PlayerRunner.PlayerException ex) {
Expand Down

0 comments on commit 92d8a27

Please sign in to comment.