diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt index 7e8495d6..5223cefc 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailFragment.kt @@ -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() diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt index 0b6764a0..22f7ffa2 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt @@ -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 diff --git a/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt b/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt index 79da5ba6..ec0345fb 100644 --- a/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt +++ b/app/src/main/java/com/futo/platformplayer/views/video/FutoVideoPlayer.kt @@ -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) {