mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-05-02 23:54:29 +02:00
Merge branch 'tablet-rotation-issue' into 'master'
more recent landscape and rotation issues See merge request videostreaming/grayjay!66
This commit is contained in:
commit
1b8b8f5738
@ -99,10 +99,7 @@ class VideoDetailFragment() : MainFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun isSmallWindow(): Boolean {
|
private fun isSmallWindow(): Boolean {
|
||||||
return min(
|
return resources.configuration.smallestScreenWidthDp < resources.getInteger(R.integer.column_width_dp) * 2
|
||||||
resources.configuration.screenWidthDp,
|
|
||||||
resources.configuration.screenHeightDp
|
|
||||||
) < resources.getInteger(R.integer.column_width_dp) * 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isAutoRotateEnabled(): Boolean {
|
private fun isAutoRotateEnabled(): Boolean {
|
||||||
@ -122,6 +119,7 @@ class VideoDetailFragment() : MainFragment() {
|
|||||||
isSmallWindow
|
isSmallWindow
|
||||||
&& newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE
|
&& newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||||
&& !isFullscreen
|
&& !isFullscreen
|
||||||
|
&& !isInPictureInPicture
|
||||||
&& state == State.MAXIMIZED
|
&& state == State.MAXIMIZED
|
||||||
) {
|
) {
|
||||||
_viewDetail?.setFullscreen(true)
|
_viewDetail?.setFullscreen(true)
|
||||||
@ -158,6 +156,8 @@ class VideoDetailFragment() : MainFragment() {
|
|||||||
) {
|
) {
|
||||||
_viewDetail?.setFullscreen(true)
|
_viewDetail?.setFullscreen(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateOrientation()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateOrientation() {
|
fun updateOrientation() {
|
||||||
@ -167,7 +167,7 @@ class VideoDetailFragment() : MainFragment() {
|
|||||||
val rotationLock = StatePlayer.instance.rotationLock
|
val rotationLock = StatePlayer.instance.rotationLock
|
||||||
val alwaysAllowReverseLandscapeAutoRotate = Settings.instance.playback.alwaysAllowReverseLandscapeAutoRotate
|
val alwaysAllowReverseLandscapeAutoRotate = Settings.instance.playback.alwaysAllowReverseLandscapeAutoRotate
|
||||||
|
|
||||||
val isLandscapeVideo: Boolean = _viewDetail?.isLandscapeVideo() ?: false
|
val isLandscapeVideo: Boolean = _viewDetail?.isLandscapeVideo() ?: true
|
||||||
|
|
||||||
val isSmallWindow = isSmallWindow()
|
val isSmallWindow = isSmallWindow()
|
||||||
val autoRotateEnabled = isAutoRotateEnabled()
|
val autoRotateEnabled = isAutoRotateEnabled()
|
||||||
|
@ -2384,8 +2384,13 @@ class VideoDetailView : ConstraintLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isLandscapeVideo(): Boolean? {
|
fun isLandscapeVideo(): Boolean? {
|
||||||
val videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width
|
var videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width
|
||||||
val videoSourceHeight = _player.exoPlayer?.player?.videoSize?.height
|
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){
|
return if (videoSourceWidth == null || videoSourceHeight == null || videoSourceWidth == 0 || videoSourceHeight == 0){
|
||||||
null
|
null
|
||||||
|
@ -592,11 +592,6 @@ 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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user