mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-09-18 15:32:35 +00:00
Fix live stream PiP mode
Prevent splash screen when opening PiP mode Changelog: changed
This commit is contained in:
parent
4fa0229ccb
commit
515c5e00e9
2 changed files with 19 additions and 4 deletions
|
@ -429,6 +429,9 @@ class VideoDetailView : ConstraintLayout {
|
|||
showChaptersUI();
|
||||
};
|
||||
|
||||
_layoutPlayerContainer.addOnLayoutChangeListener { v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom ->
|
||||
onShouldEnterPictureInPictureChanged.emit()
|
||||
}
|
||||
|
||||
_buttonSubscribe.onSubscribed.subscribe {
|
||||
_slideUpOverlay = UISlideOverlays.showSubscriptionOptionsOverlay(it, _overlayContainer);
|
||||
|
@ -2746,6 +2749,7 @@ class VideoDetailView : ConstraintLayout {
|
|||
|
||||
_overlayContainer.removeAllViews();
|
||||
_overlay_quality_selector?.hide();
|
||||
_container_content.visibility = GONE
|
||||
|
||||
_player.fillHeight(false)
|
||||
_layoutPlayerContainer.setPadding(0, 0, 0, 0);
|
||||
|
@ -2754,11 +2758,16 @@ class VideoDetailView : ConstraintLayout {
|
|||
Logger.i(TAG, "handleLeavePictureInPicture")
|
||||
|
||||
if(!_player.isFullScreen) {
|
||||
_container_content.visibility = VISIBLE
|
||||
_player.fitHeight();
|
||||
_layoutPlayerContainer.setPadding(0, 0, 0, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6.0f, Resources.getSystem().displayMetrics).toInt());
|
||||
} else {
|
||||
_layoutPlayerContainer.setPadding(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
_layoutPlayerContainer.post {
|
||||
onShouldEnterPictureInPictureChanged.emit()
|
||||
}
|
||||
}
|
||||
fun getPictureInPictureParams() : PictureInPictureParams {
|
||||
var videoSourceWidth = _player.exoPlayer?.player?.videoSize?.width ?: 0;
|
||||
|
@ -2778,9 +2787,7 @@ class VideoDetailView : ConstraintLayout {
|
|||
videoSourceWidth = 9;
|
||||
}
|
||||
|
||||
val r = Rect();
|
||||
_player.getGlobalVisibleRect(r);
|
||||
r.right = r.right - _player.paddingEnd;
|
||||
val r = _player.getVideoRect()
|
||||
val playpauseAction = if(_player.playing)
|
||||
RemoteAction(Icon.createWithResource(context, R.drawable.ic_pause_notif), context.getString(R.string.pause), context.getString(R.string.pauses_the_video), MediaControlReceiver.getPauseIntent(context, 5));
|
||||
else
|
||||
|
@ -2789,7 +2796,8 @@ class VideoDetailView : ConstraintLayout {
|
|||
val toBackgroundAction = RemoteAction(Icon.createWithResource(context, R.drawable.ic_screen_share), context.getString(R.string.background), context.getString(R.string.background_switch_audio), MediaControlReceiver.getToBackgroundIntent(context, 7));
|
||||
|
||||
val params = PictureInPictureParams.Builder()
|
||||
.setAspectRatio(Rational(videoSourceWidth, videoSourceHeight)).setSourceRectHint(r)
|
||||
.setAspectRatio(Rational(videoSourceWidth, videoSourceHeight))
|
||||
.setSourceRectHint(r)
|
||||
.setActions(listOf(toBackgroundAction, playpauseAction))
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
import android.graphics.Rect
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.media.AudioManager
|
||||
import android.net.Uri
|
||||
|
@ -464,6 +465,12 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
|
|||
_control_autoplay_fullscreen.setColorFilter(ContextCompat.getColor(context, if (StatePlayer.instance.autoplay) com.futo.futopay.R.color.primary else R.color.white))
|
||||
}
|
||||
|
||||
fun getVideoRect(): Rect {
|
||||
val r = Rect()
|
||||
_videoView.getGlobalVisibleRect(r)
|
||||
return r
|
||||
}
|
||||
|
||||
private fun setSystemBrightness(brightness: Float) {
|
||||
Log.i(TAG, "setSystemBrightness $brightness")
|
||||
if (android.provider.Settings.System.canWrite(context)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue