Skip to content
Snippets Groups Projects
Verified Commit 7557e6f6 authored by Kai DeLorenzo's avatar Kai DeLorenzo :purple_heart:
Browse files

prevent going full screen before the video has loaded

parent 86b69389
No related branches found
No related tags found
1 merge request!53Spinner block player go full screen
...@@ -2379,13 +2379,8 @@ class VideoDetailView : ConstraintLayout { ...@@ -2379,13 +2379,8 @@ class VideoDetailView : ConstraintLayout {
} }
fun isLandscapeVideo(): Boolean? { fun isLandscapeVideo(): Boolean? {
var videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width val videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width
var videoSourceHeight = _player.exoPlayer?.player?.videoSize?.height val videoSourceHeight = _player.exoPlayer?.player?.videoSize?.height
if (videoSourceWidth == null || videoSourceHeight == null || videoSourceWidth == 0 || videoSourceHeight == 0){
videoSourceWidth = this.video?.video?.videoSources?.get(0)?.width
videoSourceHeight = this.video?.video?.videoSources?.get(0)?.height
}
return if (videoSourceWidth == null || videoSourceHeight == null || videoSourceWidth == 0 || videoSourceHeight == 0){ return if (videoSourceWidth == null || videoSourceHeight == null || videoSourceWidth == 0 || videoSourceHeight == 0){
null null
......
...@@ -592,6 +592,11 @@ class FutoVideoPlayer : FutoVideoPlayerBase { ...@@ -592,6 +592,11 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
@OptIn(UnstableApi::class) @OptIn(UnstableApi::class)
fun setFullScreen(fullScreen: Boolean) { 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() updateRotateLock()
if (isFullScreen == fullScreen) { if (isFullScreen == fullScreen) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment