mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Merge pull request #1428 from DennisBauer/1411-Fix_bug_when_starting_video_in_external_player
Do not stat pip when open video externally
This commit is contained in:
commit
d57ec17662
@ -166,6 +166,7 @@ class PlayerFragment : BaseFragment() {
|
|||||||
private var sponsorBlockNotifications = true
|
private var sponsorBlockNotifications = true
|
||||||
private var skipButtonsEnabled = false
|
private var skipButtonsEnabled = false
|
||||||
private var pipEnabled = true
|
private var pipEnabled = true
|
||||||
|
private var videoShownInExternalPlayer = false
|
||||||
private var skipSegmentsManually = false
|
private var skipSegmentsManually = false
|
||||||
private var progressiveLoadingIntervalSize = "64"
|
private var progressiveLoadingIntervalSize = "64"
|
||||||
|
|
||||||
@ -666,6 +667,13 @@ class PlayerFragment : BaseFragment() {
|
|||||||
if (!commentsLoaded!!) fetchComments()
|
if (!commentsLoaded!!) fetchComments()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
|
||||||
|
// Assuming the video is not playing in external player when returning to app
|
||||||
|
videoShownInExternalPlayer = false
|
||||||
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
// pauses the player if the screen is turned off
|
// pauses the player if the screen is turned off
|
||||||
|
|
||||||
@ -1049,6 +1057,9 @@ class PlayerFragment : BaseFragment() {
|
|||||||
|
|
||||||
if (response.hls != null) {
|
if (response.hls != null) {
|
||||||
binding.relPlayerOpen.setOnClickListener {
|
binding.relPlayerOpen.setOnClickListener {
|
||||||
|
// Do not start picture in picture when playing in external player
|
||||||
|
videoShownInExternalPlayer = true
|
||||||
|
|
||||||
// start an intent with video as mimetype using the hls stream
|
// start an intent with video as mimetype using the hls stream
|
||||||
val uri: Uri = Uri.parse(response.hls)
|
val uri: Uri = Uri.parse(response.hls)
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
@ -1523,7 +1534,12 @@ class PlayerFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun shouldStartPiP(): Boolean {
|
private fun shouldStartPiP(): Boolean {
|
||||||
if (!pipEnabled || exoPlayer.playbackState == PlaybackState.STATE_PAUSED) return false
|
if (!pipEnabled ||
|
||||||
|
exoPlayer.playbackState == PlaybackState.STATE_PAUSED ||
|
||||||
|
videoShownInExternalPlayer
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
val bounds = Rect()
|
val bounds = Rect()
|
||||||
binding.playerScrollView.getHitRect(bounds)
|
binding.playerScrollView.getHitRect(bounds)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user