1
0
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:
marevr
2022-10-29 18:54:20 +11:00
parent 7ab8f9f112
commit d4ca5f031b

View File

@@ -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) {