From fa04c8eecfbdd0b6ed082b464ca9032536d71762 Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 15 Sep 2025 16:43:04 +0400 Subject: [PATCH] fix(YouTube Music - Spoof video streams): Fix playback issues when using a cellular network Code adapted from https://github.com/inotia00/revanced-patches/commit/5f35e51a2779f71f27c3f9be62fbe83b7bc9cfe7 --- .../shared/spoof/SpoofVideoStreamsPatch.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java index 0980f816f..a23814056 100644 --- a/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java +++ b/extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java @@ -22,10 +22,19 @@ public class SpoofVideoStreamsPatch { && BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get() == ClientType.IOS_UNPLUGGED; /** - * Any unreachable ip address. Used to intentionally fail requests. + * Domain used for internet connectivity verification. + * It has an empty response body and is only used to check for a 204 response code. + *
+ * If an unreachable IP address (127.0.0.1) is used, no response code is provided. + *
+ * YouTube handles unreachable IP addresses without issue. + * YouTube Music has an issue with waiting for the Cronet connect timeout of 30s on mobile networks. + *
+ * Using a VPN or DNS can temporarily resolve this issue, + * But the ideal workaround is to avoid using an unreachable IP address. */ - private static final String UNREACHABLE_HOST_URI_STRING = "https://127.0.0.0"; - private static final Uri UNREACHABLE_HOST_URI = Uri.parse(UNREACHABLE_HOST_URI_STRING); + private static final String INTERNET_CONNECTION_CHECK_URI_STRING = "https://www.google.com/gen_204"; + private static final Uri INTERNET_CONNECTION_CHECK_URI = Uri.parse(INTERNET_CONNECTION_CHECK_URI_STRING); /** * @return If this patch was included during patching. @@ -53,9 +62,9 @@ public class SpoofVideoStreamsPatch { String path = playerRequestUri.getPath(); if (path != null && path.contains("get_watch")) { - Logger.printDebug(() -> "Blocking 'get_watch' by returning unreachable uri"); + Logger.printDebug(() -> "Blocking 'get_watch' by returning internet connection check uri"); - return UNREACHABLE_HOST_URI; + return INTERNET_CONNECTION_CHECK_URI; } } catch (Exception ex) { Logger.printException(() -> "blockGetWatchRequest failure", ex); @@ -77,9 +86,9 @@ public class SpoofVideoStreamsPatch { String path = originalUri.getPath(); if (path != null && path.contains("initplayback")) { - Logger.printDebug(() -> "Blocking 'initplayback' by clearing query"); + Logger.printDebug(() -> "Blocking 'initplayback' by returning internet connection check uri"); - return originalUri.buildUpon().clearQuery().build().toString(); + return INTERNET_CONNECTION_CHECK_URI_STRING; } } catch (Exception ex) { Logger.printException(() -> "blockInitPlaybackRequest failure", ex);