mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
fix(YouTube): Playback speed sometimes changes to 1.0x in Shorts (Unpatched YouTube bug)
This commit is contained in:
parent
79f933dad4
commit
e157e9447d
@ -1,20 +1,24 @@
|
||||
package app.revanced.extension.youtube.patches.utils;
|
||||
|
||||
import app.revanced.extension.shared.utils.Logger;
|
||||
import app.revanced.extension.youtube.shared.EngagementPanel;
|
||||
import app.revanced.extension.youtube.shared.PlayerType;
|
||||
import app.revanced.extension.youtube.shared.ShortsPlayerState;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class PlaybackSpeedWhilePlayingPatch {
|
||||
private static final float DEFAULT_YOUTUBE_PLAYBACK_SPEED = 1.0f;
|
||||
|
||||
public static boolean playbackSpeedChanged(float playbackSpeed) {
|
||||
PlayerType playerType = PlayerType.getCurrent();
|
||||
if (playbackSpeed == DEFAULT_YOUTUBE_PLAYBACK_SPEED &&
|
||||
playerType.isMaximizedOrFullscreenOrPiP()) {
|
||||
if (playbackSpeed == DEFAULT_YOUTUBE_PLAYBACK_SPEED) {
|
||||
if (PlayerType.getCurrent().isMaximizedOrFullscreenOrPiP()
|
||||
// Since RVX has a default playback speed setting for Shorts,
|
||||
// Playback speed reset should also be prevented in Shorts.
|
||||
|| ShortsPlayerState.getCurrent().isOpen() && EngagementPanel.isOpen()) {
|
||||
Logger.printDebug(() -> "Ignore changing playback speed, as it is invalid request");
|
||||
|
||||
Logger.printDebug(() -> "Ignore changing playback speed, as it is invalid request: " + playerType.name());
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -4,6 +4,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.bytecodePatch
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.utils.engagement.engagementPanelHookPatch
|
||||
import app.revanced.patches.youtube.utils.extension.Constants.UTILS_PATH
|
||||
import app.revanced.patches.youtube.utils.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.utils.playertype.playerTypeHookPatch
|
||||
@ -22,6 +23,7 @@ val playbackSpeedWhilePlayingPatch = bytecodePatch(
|
||||
) {
|
||||
dependsOn(
|
||||
sharedExtensionPatch,
|
||||
engagementPanelHookPatch,
|
||||
playerTypeHookPatch,
|
||||
versionCheckPatch,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user