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 1/2] 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); From 52c136439e8691a4d0e603b60157816ee6d32d95 Mon Sep 17 00:00:00 2001 From: Tom <25043847+Douile@users.noreply.github.com> Date: Thu, 22 Jul 2021 10:47:47 +0000 Subject: [PATCH 2/2] Use loadUrl instead of loadData Co-authored-by: Stypox --- .../main/java/org/schabi/newpipe/error/ReCaptchaActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4687129e4..cd6a882ae 100644 --- a/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java +++ b/app/src/main/java/org/schabi/newpipe/error/ReCaptchaActivity.java @@ -163,7 +163,7 @@ public class ReCaptchaActivity extends AppCompatActivity { } // Navigate to blank page (unloads youtube to prevent background playback) - recaptchaBinding.reCaptchaWebView.loadData("", "text/html", null); + recaptchaBinding.reCaptchaWebView.loadUrl("about:blank"); final Intent intent = new Intent(this, org.schabi.newpipe.MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);