From e46b0369c1e37291a321137e7856c255bda19e2f Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Wed, 11 Dec 2024 00:50:56 +0400 Subject: [PATCH] fix(YouTube Music - Spoof video streams): Disable stable volume --- .../extension/shared/spoof/SpoofVideoStreamsPatch.java | 8 ++++++++ .../patches/music/misc/spoof/SpoofVideoStreamsPatch.kt | 10 +++++++++- .../shared/misc/spoof/SpoofVideoStreamsPatch.kt | 2 +- 3 files changed, 18 insertions(+), 2 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 4016c8ef99..5ad672f126 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,6 +22,14 @@ public class SpoofVideoStreamsPatch { 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); + /** + * Injection point. Used by YT Music to disable stable volume. + */ + public static void setClientTypeToAndroidVrNoHl() { + Logger.printDebug(() -> "Setting stream spoofing to: " + ClientType.ANDROID_VR_NO_HL); + BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.save(ClientType.ANDROID_VR_NO_HL); + } + /** * Injection point. * Blocks /get_watch requests by returning an unreachable URI. diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt index 862bc3f227..573ac0c154 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofVideoStreamsPatch.kt @@ -1,7 +1,15 @@ package app.revanced.patches.music.misc.spoof +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction +import app.revanced.patches.music.misc.gms.musicActivityOnCreateFingerprint +import app.revanced.patches.shared.misc.spoof.EXTENSION_CLASS_DESCRIPTOR import app.revanced.patches.shared.misc.spoof.spoofVideoStreamsPatch val spoofVideoStreamsPatch = spoofVideoStreamsPatch({ compatibleWith("com.google.android.apps.youtube.music") -}) +}, { + musicActivityOnCreateFingerprint.method.addInstruction( + 0, + "invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->setClientTypeToAndroidVrNoHl()V" + ) +}) \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt index 0e9e831261..9b64e386b3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt @@ -23,7 +23,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -private const val EXTENSION_CLASS_DESCRIPTOR = +internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/shared/spoof/SpoofVideoStreamsPatch;" fun spoofVideoStreamsPatch(