Fix playback not working after player enters idle state
On some phones (e.g. Oppo and Oneplus) the video player enters the STATE_IDLE 10 minutes after being paused. This causes the play button to stop working. This happens because once a player has become idle, we need to call prepare() before playback can happen again. But after I added prepare(), it would just skip to the end of the video. So now I'm executing the same code that happens when ERROR_CODE_UNSPECIFIED is done. This causes playback to resume normally.
This commit is contained in:
parent
05333265ec
commit
a719b898a1
1 changed files with 7 additions and 0 deletions
|
|
@ -1752,6 +1752,13 @@ public final class Player implements PlaybackListener, Listener {
|
|||
}
|
||||
}
|
||||
|
||||
if (isStopped()) {
|
||||
// Some phones suspend a paused player after 10 minutes. This causes the player to
|
||||
// enter STATE_IDLE, causing playback to fail. So we try to recover from that here.
|
||||
setRecovery();
|
||||
reloadPlayQueueManager();
|
||||
}
|
||||
|
||||
simpleExoPlayer.play();
|
||||
saveStreamProgressState();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue