Skip to content

Commit 16bb9df

Browse files
fix(YouTube Music - Spoof video streams): Disable stable volume (ReVanced#4097)
1 parent e450c60 commit 16bb9df

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/SpoofVideoStreamsPatch.java

+8
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ public class SpoofVideoStreamsPatch {
2222
private static final String UNREACHABLE_HOST_URI_STRING = "https://127.0.0.0";
2323
private static final Uri UNREACHABLE_HOST_URI = Uri.parse(UNREACHABLE_HOST_URI_STRING);
2424

25+
/**
26+
* Injection point. Used by YT Music to disable stable volume.
27+
*/
28+
public static void setClientTypeToAndroidVrNoHl() {
29+
Logger.printDebug(() -> "Setting stream spoofing to: " + ClientType.ANDROID_VR_NO_HL);
30+
BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.save(ClientType.ANDROID_VR_NO_HL);
31+
}
32+
2533
/**
2634
* Injection point.
2735
* Blocks /get_watch requests by returning an unreachable URI.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
package app.revanced.patches.music.misc.spoof
22

3+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
4+
import app.revanced.patches.music.misc.gms.musicActivityOnCreateFingerprint
5+
import app.revanced.patches.shared.misc.spoof.EXTENSION_CLASS_DESCRIPTOR
36
import app.revanced.patches.shared.misc.spoof.spoofVideoStreamsPatch
47

58
val spoofVideoStreamsPatch = spoofVideoStreamsPatch({
69
compatibleWith("com.google.android.apps.youtube.music")
7-
})
10+
}, {
11+
musicActivityOnCreateFingerprint.method.addInstruction(
12+
0,
13+
"invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->setClientTypeToAndroidVrNoHl()V"
14+
)
15+
})

patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
2323
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
2424
import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter
2525

26-
private const val EXTENSION_CLASS_DESCRIPTOR =
26+
internal const val EXTENSION_CLASS_DESCRIPTOR =
2727
"Lapp/revanced/extension/shared/spoof/SpoofVideoStreamsPatch;"
2828

2929
fun spoofVideoStreamsPatch(

0 commit comments

Comments
 (0)