fixes for:

weird tablet issues on some screen sizes
horizontal maximized player on phones
always allow full screen rotation not working
This commit is contained in:
Kai 2024-12-14 14:41:28 -06:00
parent ccf21b7580
commit 53df19b477
No known key found for this signature in database
3 changed files with 12 additions and 12 deletions

View file

@ -99,10 +99,7 @@ class VideoDetailFragment() : MainFragment() {
}
private fun isSmallWindow(): Boolean {
return min(
resources.configuration.screenWidthDp,
resources.configuration.screenHeightDp
) < resources.getInteger(R.integer.column_width_dp) * 2
return resources.configuration.smallestScreenWidthDp < resources.getInteger(R.integer.column_width_dp) * 2
}
private fun isAutoRotateEnabled(): Boolean {
@ -122,6 +119,7 @@ class VideoDetailFragment() : MainFragment() {
isSmallWindow
&& newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE
&& !isFullscreen
&& !isInPictureInPicture
&& state == State.MAXIMIZED
) {
_viewDetail?.setFullscreen(true)
@ -158,6 +156,8 @@ class VideoDetailFragment() : MainFragment() {
) {
_viewDetail?.setFullscreen(true)
}
updateOrientation()
}
fun updateOrientation() {
@ -167,7 +167,7 @@ class VideoDetailFragment() : MainFragment() {
val rotationLock = StatePlayer.instance.rotationLock
val alwaysAllowReverseLandscapeAutoRotate = Settings.instance.playback.alwaysAllowReverseLandscapeAutoRotate
val isLandscapeVideo: Boolean = _viewDetail?.isLandscapeVideo() ?: false
val isLandscapeVideo: Boolean = _viewDetail?.isLandscapeVideo() ?: true
val isSmallWindow = isSmallWindow()
val autoRotateEnabled = isAutoRotateEnabled()

View file

@ -2384,8 +2384,13 @@ class VideoDetailView : ConstraintLayout {
}
fun isLandscapeVideo(): Boolean? {
val videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width
val videoSourceHeight = _player.exoPlayer?.player?.videoSize?.height
var videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width
var videoSourceHeight = _player.exoPlayer?.player?.videoSize?.height
if (video?.video?.videoSources?.isNotEmpty() == true && (videoSourceWidth == null || videoSourceHeight == null || videoSourceWidth == 0 || videoSourceHeight == 0)) {
videoSourceWidth = video?.video?.videoSources!![0].width
videoSourceHeight = video?.video?.videoSources!![0].height
}
return if (videoSourceWidth == null || videoSourceHeight == null || videoSourceWidth == 0 || videoSourceHeight == 0){
null

View file

@ -592,11 +592,6 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
@OptIn(UnstableApi::class)
fun setFullScreen(fullScreen: Boolean) {
// prevent fullscreen before the video has loaded to make sure we know whether it's a vertical or horizontal video
if(exoPlayer?.player?.videoSize?.height ?: 0 == 0 && fullScreen){
return
}
updateRotateLock()
if (isFullScreen == fullScreen) {