fix(YouTube): Playback speed sometimes changes to 1.0x in PiP mode (unpatched YouTube bug)

This commit is contained in:
inotia00 2025-02-07 18:12:53 +09:00
parent 6c37959f18
commit 08202866e7
2 changed files with 9 additions and 1 deletions

View File

@ -9,7 +9,7 @@ public class PlaybackSpeedWhilePlayingPatch {
public static boolean playbackSpeedChanged(float playbackSpeed) {
if (playbackSpeed == DEFAULT_YOUTUBE_PLAYBACK_SPEED &&
PlayerType.getCurrent().isMaximizedOrFullscreen()) {
PlayerType.getCurrent().isMaximizedOrFullscreenOrPiP()) {
Logger.printDebug(() -> "Even though playback has already started and the user has not changed the playback speed, " +
"the app attempts to change the playback speed to 1.0x." +

View File

@ -137,6 +137,14 @@ enum class PlayerType {
return this == WATCH_WHILE_MAXIMIZED || this == WATCH_WHILE_FULLSCREEN
}
/**
* Check if the current player type is
* [WATCH_WHILE_MAXIMIZED], [WATCH_WHILE_FULLSCREEN], [WATCH_WHILE_PICTURE_IN_PICTURE]
*/
fun isMaximizedOrFullscreenOrPiP(): Boolean {
return isMaximizedOrFullscreen() || this == WATCH_WHILE_PICTURE_IN_PICTURE
}
/**
* Check if the current player type is
* [WATCH_WHILE_FULLSCREEN], [WATCH_WHILE_SLIDING_MAXIMIZED_FULLSCREEN].