do not crash when audio file reports zero length
This commit is contained in:
parent
97745bdfbe
commit
eb943619af
|
@ -346,8 +346,12 @@ public class AudioPlayer implements View.OnClickListener, MediaPlayer.OnCompleti
|
|||
return false;
|
||||
}
|
||||
final ViewHolder viewHolder = ViewHolder.get(audioPlayer);
|
||||
if (duration <= 0) {
|
||||
viewHolder.progress.setProgress(100);
|
||||
} else {
|
||||
viewHolder.progress.setProgress(current * 100 / duration);
|
||||
viewHolder.runtime.setText(formatTime(current) + " / " + formatTime(duration));
|
||||
}
|
||||
viewHolder.runtime.setText(String.format("%s / %s", formatTime(current), formatTime(duration)));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue