diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java index ecfaf96d3b..9054e425b6 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/ExitFullscreenPatch.java @@ -28,19 +28,19 @@ public static void setVideoTime(long millis) { return; } - if (Utils.isLandscapeOrientation()) { - if (mode == FullscreenMode.PORTRAIT) { + if (VideoInformation.isAtEndOfVideo() + && VideoState.getCurrent() == VideoState.PLAYING + && PlayerType.getCurrent() == PlayerType.WATCH_WHILE_FULLSCREEN) { + + if (Utils.isLandscapeOrientation()) { + if (mode == FullscreenMode.PORTRAIT) { + return; + } + } else if (mode == FullscreenMode.LANDSCAPE) { return; } - } else if (mode == FullscreenMode.LANDSCAPE) { - return; - } - if (PlayerType.getCurrent() == PlayerType.WATCH_WHILE_FULLSCREEN - && VideoState.getCurrent() == VideoState.PLAYING - && VideoInformation.isAtEndOfVideo()) { ImageView fullscreenButton = PlayerControlsPatch.fullscreenButtonRef.get(); - if (fullscreenButton != null) { Logger.printDebug(() -> "Clicking fullscreen button"); fullscreenButton.performClick(); diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/shared/PlayerType.kt b/extensions/youtube/src/main/java/app/revanced/extension/youtube/shared/PlayerType.kt index 2dfa225e52..5964e5fe69 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/shared/PlayerType.kt +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/shared/PlayerType.kt @@ -73,7 +73,7 @@ enum class PlayerType { onChange(currentPlayerType) } - @Volatile // Rread/write from different threads. + @Volatile // Read/write from different threads. private var currentPlayerType = NONE /**