Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1421,13 +1421,6 @@ private void restoreDefaultOrientation() {
if (player != null && player.isFullscreen()) {
player.toggleFullscreen();
}
// This will show systemUI and pause the player.
// User can tap on Play button and video will be in fullscreen mode again
// Note for tablet: trying to avoid orientation changes since it's not easy
// to physically rotate the tablet every time
if (!DeviceUtils.isTablet(activity)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1937,6 +1930,11 @@ public void onScreenRotationButtonClicked() {
return;
}

if (isLandscape() && PlayerHelper.globalScreenOrientationLocked(activity)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
return;
}

final int newOrientation = isLandscape()
? ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
: ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,15 @@ public void toggleFullscreen() {
return;
}

// This makes the button function correctly if you disable auto-rotate
// while watching a vertical video and your phones in landscape
final boolean orientationLocked = PlayerHelper.globalScreenOrientationLocked(service);
final boolean isTablet = DeviceUtils.isTablet(service);
if (orientationLocked && isFullscreen && service.isLandscape() && !isTablet) {
fragmentListener.onScreenRotationButtonClicked();
return;
}

isFullscreen = !isFullscreen;
setControlsSize();
fragmentListener.onFullscreenStateChanged(isFullscreen());
Expand Down