-Fix restart button not working

This commit is contained in:
John Zhen M 2017-09-08 07:52:38 -07:00 committed by John Zhen Mo
parent 53cec61cdf
commit c38e4190f1
2 changed files with 2 additions and 1 deletions

View File

@ -695,6 +695,7 @@ public abstract class BasePlayer implements Player.EventListener,
if (!isPlaying()) audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
else audioManager.abandonAudioFocus(this);
if (getCurrentState() == STATE_COMPLETED) playQueue.setIndex(0);
simpleExoPlayer.setPlayWhenReady(!isPlaying());
}

View File

@ -124,7 +124,7 @@ public abstract class PlayQueue implements Serializable {
// Write ops
//////////////////////////////////////////////////////////////////////////*/
private synchronized void setIndex(final int index) {
public synchronized void setIndex(final int index) {
if (index < 0 || index >= streams.size()) return;
queueIndex.set(Math.min(Math.max(0, index), streams.size() - 1));