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