mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-09-20 03:24:03 +00:00
Pauses the player when the internet disconnects at the end of its buffer.
This commit is contained in:
@@ -1423,6 +1423,10 @@ public final class Player implements PlaybackListener, Listener {
|
||||
case ERROR_CODE_TIMEOUT:
|
||||
case ERROR_CODE_IO_UNSPECIFIED:
|
||||
case ERROR_CODE_IO_NETWORK_CONNECTION_FAILED:
|
||||
isCatchableException = true;
|
||||
simpleExoPlayer.pause();
|
||||
onPaused();
|
||||
break;
|
||||
case ERROR_CODE_IO_NETWORK_CONNECTION_TIMEOUT:
|
||||
case ERROR_CODE_UNSPECIFIED:
|
||||
// Reload playback on unexpected errors:
|
||||
@@ -1597,6 +1601,11 @@ public final class Player implements PlaybackListener, Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isPrepared) {
|
||||
simpleExoPlayer.prepare();
|
||||
isPrepared = true;
|
||||
}
|
||||
|
||||
audioReactor.requestAudioFocus();
|
||||
|
||||
if (currentState == STATE_COMPLETED) {
|
||||
|
Reference in New Issue
Block a user