Stop looping over unplayable songs

This commit is contained in:
Andrew Rabert 2019-12-13 00:25:51 -05:00
parent bf3233d6b2
commit 22c98d9606
1 changed files with 4 additions and 9 deletions

View File

@ -1370,15 +1370,10 @@ public class DownloadService extends Service {
final int duration = downloadFile.getSong().getDuration() == null ? 0 : downloadFile.getSong().getDuration() * 1000; final int duration = downloadFile.getSong().getDuration() == null ? 0 : downloadFile.getSong().getDuration() * 1000;
mediaPlayer.setOnErrorListener((mediaPlayer, what, extra) -> { mediaPlayer.setOnErrorListener((mediaPlayer, what, extra) -> {
Log.w(TAG, "Error on playing file " + "(" + what + ", " + extra + "): " + downloadFile); Log.w(TAG, "Error on playing file " + "(" + what + ", " + extra + "): " + downloadFile);
int pos = getPlayerPosition(); int index = getNextPlayingIndex();
reset(); remove(downloadFile);
if (!isPartial || (downloadFile.isWorkDone() && (Math.abs(duration - pos) < 10000))) { downloadFile.delete();
playNext(); play(index - 1);
} else {
downloadFile.setPlaying(false);
doPlay(downloadFile, pos, isPlaying);
downloadFile.setPlaying(true);
}
return true; return true;
}); });