From cd86ed38770b9bf7b3e54ef6a9ec1c512806e405 Mon Sep 17 00:00:00 2001 From: Douile <25043847+Douile@users.noreply.github.com> Date: Thu, 22 Jul 2021 02:31:26 +0100 Subject: [PATCH] Prevent recaptcha webview from keeping youtube loaded in background After the cookies are extracted from the recaptcha webview make it load an empty page to prevent youtube being loaded unecessarily in the background. --- .../main/java/org/schabi/newpipe/error/ReCaptchaActivity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java index 23df7ed95..4687129e4 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java +++ b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java @@ -162,6 +162,9 @@ public class ReCaptchaActivity extends AppCompatActivity { setResult(RESULT_OK); } + // Navigate to blank page (unloads youtube to prevent background playback) + recaptchaBinding.reCaptchaWebView.loadData("", "text/html", null); + final Intent intent = new Intent(this, org.schabi.newpipe.MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); NavUtils.navigateUpTo(this, intent);