-Fix restart button not working
This commit is contained in:
parent
53cec61cdf
commit
c38e4190f1
|
@ -695,6 +695,7 @@ public abstract class BasePlayer implements Player.EventListener,
|
||||||
if (!isPlaying()) audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
|
if (!isPlaying()) audioManager.requestAudioFocus(this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
|
||||||
else audioManager.abandonAudioFocus(this);
|
else audioManager.abandonAudioFocus(this);
|
||||||
|
|
||||||
|
if (getCurrentState() == STATE_COMPLETED) playQueue.setIndex(0);
|
||||||
simpleExoPlayer.setPlayWhenReady(!isPlaying());
|
simpleExoPlayer.setPlayWhenReady(!isPlaying());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ public abstract class PlayQueue implements Serializable {
|
||||||
// Write ops
|
// Write ops
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
private synchronized void setIndex(final int index) {
|
public synchronized void setIndex(final int index) {
|
||||||
if (index < 0 || index >= streams.size()) return;
|
if (index < 0 || index >= streams.size()) return;
|
||||||
|
|
||||||
queueIndex.set(Math.min(Math.max(0, index), streams.size() - 1));
|
queueIndex.set(Math.min(Math.max(0, index), streams.size() - 1));
|
||||||
|
|
Loading…
Reference in New Issue