Skip to content

Commit 6f0def7

Browse files
committed
fix bug in media quality
Signed-off-by: Dev4Mod <[email protected]>
1 parent acafbc6 commit 6f0def7

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/core/devkit/Unobfuscator.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,4 +1722,13 @@ public static Class<?> loadFragmentClass(ClassLoader classLoader) throws Excepti
17221722
return clazz;
17231723
});
17241724
}
1725+
1726+
public static Method loadMediaQualitySelectionMethod(ClassLoader classLoader) throws Exception {
1727+
return UnobfuscatorCache.getInstance().getMethod(classLoader, () -> {
1728+
var method = findFirstMethodUsingStrings(classLoader, StringMatchType.Contains, "enable_media_quality_tool");
1729+
if (method == null)
1730+
throw new RuntimeException("MediaQualitySelection method not found");
1731+
return method;
1732+
});
1733+
}
17251734
}

app/src/main/java/com/wmods/wppenhacer/xposed/features/media/MediaQuality.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public void doHook() throws Exception {
4444

4545
Others.propsBoolean.put(7950, false); // Força o uso do MediaComposer para processar os videos
4646

47+
// Enable Media Quality selection for Stories
48+
var hookMediaQualitySelection = Unobfuscator.loadMediaQualitySelectionMethod(classLoader);
49+
XposedBridge.hookMethod(hookMediaQualitySelection, XC_MethodReplacement.returnConstant(true));
50+
4751
if (videoQuality) {
4852

4953
Others.propsBoolean.put(5549, true); // Use bitrate from json to force video high quality
@@ -106,20 +110,18 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
106110

107111
// HD video must be sent in maximum resolution (up to 4K)
108112
if (realResolution) {
109-
Others.propsInteger.put(594, 8000); // chat
110-
Others.propsInteger.put(12852, 8000); // chat
111-
Others.propsInteger.put(3183, 8000); // Stories
112-
Others.propsInteger.put(4685, 8000); // Stories
113+
Others.propsInteger.put(594, 8000);
114+
Others.propsInteger.put(12852, 8000);
113115
} else {
114-
Others.propsInteger.put(594, 1920); // chat
115-
Others.propsInteger.put(12852, 1920); // chat
116-
Others.propsInteger.put(3183, 1920); // Stories
117-
Others.propsInteger.put(4685, 1920); // Stories
116+
Others.propsInteger.put(594, 1920);
117+
Others.propsInteger.put(12852, 1920);
118118
}
119119

120120
// Non-HD video must be sent in HD resolution
121121
Others.propsInteger.put(4686, 1280);
122122
Others.propsInteger.put(3654, 1280);
123+
Others.propsInteger.put(3183, 1280); // Stories
124+
Others.propsInteger.put(4685, 1280); // Stories
123125

124126
// Max bitrate
125127
Others.propsInteger.put(3755, 96000);

0 commit comments

Comments
 (0)