Skip to content

Commit

Permalink
Youtube Music:
Browse files Browse the repository at this point in the history
- EnableExclusiveAudioPlayback
  • Loading branch information
chsbuffer committed Jun 16, 2024
1 parent 5bcc3c5 commit c90067c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions app/src/main/java/io/github/chsbuffer/revancedxposed/MusicHook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class MusicHook(val app: Application, val lpparam: LoadPackageParam) {
MinimizedPlayback()
RemoveUpgradeButton()
HideGetPremium()
EnableExclusiveAudioPlayback()
saveCache()
} catch (err: Exception) {
pref.edit().clear().apply()
Expand All @@ -46,6 +47,37 @@ class MusicHook(val app: Application, val lpparam: LoadPackageParam) {
}
}

private fun EnableExclusiveAudioPlayback() {
getMethodData("AllowExclusiveAudioPlaybackFingerprint") {
dexkit.findMethod {
matcher {
returnType = "boolean"
modifiers = Modifier.PUBLIC or Modifier.FINAL
paramCount = 0
opNames = listOf(
"invoke-virtual",
"move-result-object",
"check-cast",
"if-nez",
"iget-object",
"invoke-virtual",
"move-result",
"goto",
"invoke-virtual",
"move-result",
"return",

)
}
}.single()
}.let {
XposedBridge.hookMethod(
it.getMethodInstance(lpparam.classLoader),
XC_MethodReplacement.returnConstant(true)
)
}
}

@Suppress("UNCHECKED_CAST")
fun loadCache(): Boolean {
pref = app.getSharedPreferences("xprevanced", Context.MODE_PRIVATE)
Expand Down

0 comments on commit c90067c

Please sign in to comment.