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 c90c1da6..909a654f 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,8 @@ class VideoDetailView : ConstraintLayout { } fun isLandscapeVideo(): Boolean? { - var videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width - var videoSourceHeight = _player.exoPlayer?.player?.videoSize?.height + val videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width + val videoSourceHeight = _player.exoPlayer?.player?.videoSize?.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 8767031e..740740fa 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,6 +592,11 @@ 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) {