diff --git a/app/src/main/java/org/schabi/newpipe/player/Player.java b/app/src/main/java/org/schabi/newpipe/player/Player.java index 2f1711319ed..0fdea464ab3 100644 --- a/app/src/main/java/org/schabi/newpipe/player/Player.java +++ b/app/src/main/java/org/schabi/newpipe/player/Player.java @@ -1,6 +1,7 @@ package org.schabi.newpipe.player; import static com.google.android.exoplayer2.PlaybackException.ERROR_CODE_BEHIND_LIVE_WINDOW; +import static com.google.android.exoplayer2.PlaybackException.ERROR_CODE_FAILED_RUNTIME_CHECK; import static com.google.android.exoplayer2.PlaybackException.ERROR_CODE_IO_BAD_HTTP_STATUS; import static com.google.android.exoplayer2.PlaybackException.ERROR_CODE_IO_CLEARTEXT_NOT_PERMITTED; import static com.google.android.exoplayer2.PlaybackException.ERROR_CODE_IO_FILE_NOT_FOUND; @@ -66,7 +67,6 @@ import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.DefaultRenderersFactory; -import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.PlaybackException; import com.google.android.exoplayer2.PlaybackParameters; @@ -1430,14 +1430,13 @@ public void onPlayerError(@NonNull final PlaybackException error) { setRecovery(); reloadPlayQueueManager(); break; - default: + case ERROR_CODE_FAILED_RUNTIME_CHECK: // Try to handle tunneling related exceptions - final ExoPlaybackException epe = !exoPlayerIsNull() - ? simpleExoPlayer.getPlayerError() : null; - if (epe != null && epe.type == ExoPlaybackException.TYPE_UNEXPECTED - && simpleExoPlayer.isTunnelingEnabled() - && Log.getStackTraceString(epe.getUnexpectedException()) - .contains("Surface")) { + Log.d(TAG, "Unexpected PlaybackException! Cause: " + + Log.getStackTraceString(error.getCause())); + if (trackSelector.getParameters().tunnelingEnabled + && Log.getStackTraceString(error.getCause()) + .contains("Surface")) { trackSelector.setParameters(trackSelector.buildUponParameters() .setTunnelingEnabled(false)); // Reload playback on unexpected errors: @@ -1445,6 +1444,8 @@ public void onPlayerError(@NonNull final PlaybackException error) { reloadPlayQueueManager(); break; } + // fall through to default + default: // API, remote and renderer errors belong here: onPlaybackShutdown(); break;