mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-06-12 13:17:38 +02:00
fix(YouTube - Exit fullscreen mode): Exit fullscreen mode of first video opened after cold start
This commit is contained in:
@ -38,13 +38,20 @@ public class ExitFullscreenPatch {
|
||||
}
|
||||
}
|
||||
|
||||
ImageView fullscreenButton = PlayerControlsPatch.fullscreenButtonRef.get();
|
||||
if (fullscreenButton == null) {
|
||||
Logger.printDebug(() -> "Fullscreen button is null, cannot click");
|
||||
} else {
|
||||
Logger.printDebug(() -> "Clicking fullscreen button");
|
||||
fullscreenButton.performClick();
|
||||
}
|
||||
// If the user cold launches the app and plays a video but does not
|
||||
// tap to show the overlay controls, the fullscreen button is not
|
||||
// set because the overlay controls are not attached.
|
||||
// To fix this, push the perform click to the back fo the main thread,
|
||||
// and by then the overlay controls will be visible since the video is now finished.
|
||||
Utils.runOnMainThread(() -> {
|
||||
ImageView button = PlayerControlsPatch.fullscreenButtonRef.get();
|
||||
if (button == null) {
|
||||
Logger.printDebug(() -> "Fullscreen button is null, cannot click");
|
||||
} else {
|
||||
Logger.printDebug(() -> "Clicking fullscreen button");
|
||||
button.performClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
Logger.printException(() -> "endOfVideoReached failure", ex);
|
||||
|
Reference in New Issue
Block a user