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 45d43704..eebaac46 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 @@ -432,10 +432,6 @@ class VideoDetailView : ConstraintLayout { showChaptersUI(); }; - _layoutPlayerContainer.addOnLayoutChangeListener { v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom -> - onShouldEnterPictureInPictureChanged.emit() - } - _title.setOnLongClickListener { val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager; val clip = ClipData.newPlainText("Video Title", (it as TextView).text); @@ -1967,6 +1963,10 @@ class VideoDetailView : ConstraintLayout { videoTrackFormats.distinctBy { it.height }.sortedBy { it.height }, audioTrackFormats.distinctBy { it.bitrate }.sortedBy { it.bitrate }); } + + _layoutPlayerContainer.post { + onShouldEnterPictureInPictureChanged.emit() + } } private var _didTriggerDatasourceErrorCount = 0; @@ -2427,7 +2427,6 @@ class VideoDetailView : ConstraintLayout { } isPlaying = playing; - onShouldEnterPictureInPictureChanged.emit() updateTracker(lastPositionMilliseconds, playing, true); } @@ -2559,6 +2558,9 @@ class VideoDetailView : ConstraintLayout { setProgressBarOverlayed(false); } onFullscreenChanged.emit(fullscreen); + _layoutPlayerContainer.post { + onShouldEnterPictureInPictureChanged.emit() + } } private fun setCastEnabled(isCasting: Boolean) { @@ -2832,10 +2834,6 @@ class VideoDetailView : ConstraintLayout { } else { _layoutPlayerContainer.setPadding(0, 0, 0, 0); } - - _layoutPlayerContainer.post { - onShouldEnterPictureInPictureChanged.emit() - } } fun getPictureInPictureParams() : PictureInPictureParams { var videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width ?: 0; 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 44bc9303..e97a1dfb 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 @@ -484,7 +484,8 @@ class FutoVideoPlayer : FutoVideoPlayerBase { fun getVideoRect(): Rect { val r = Rect() - _videoView.getGlobalVisibleRect(r) + // this is the only way i could reliably get a reference to a view that matches perfectly with the video playback + _videoView.subtitleView?.getGlobalVisibleRect(r) return r }