mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-09-29 04:39:19 +00:00
fix very wide screen videos enter PiP mode
Changelog: changed
This commit is contained in:
parent
c1e6e401cc
commit
a10bc8c7de
1 changed files with 8 additions and 1 deletions
|
@ -2844,16 +2844,23 @@ class VideoDetailView : ConstraintLayout {
|
||||||
videoSourceHeight = 9;
|
videoSourceHeight = 9;
|
||||||
}
|
}
|
||||||
val aspectRatio = videoSourceWidth.toDouble() / videoSourceHeight;
|
val aspectRatio = videoSourceWidth.toDouble() / videoSourceHeight;
|
||||||
|
val r = _player.getVideoRect()
|
||||||
if(aspectRatio > 2.38) {
|
if(aspectRatio > 2.38) {
|
||||||
videoSourceWidth = 16;
|
videoSourceWidth = 16;
|
||||||
videoSourceHeight = 9;
|
videoSourceHeight = 9;
|
||||||
|
|
||||||
|
// shrink the left and right equally to get the rect to be 16 by 9 aspect ratio
|
||||||
|
// we don't want a picture in picture mode that's more squashed than 16 by 9
|
||||||
|
val targetWidth = r.height() * 16 / 9
|
||||||
|
val shrinkAmount = (r.width() - targetWidth) / 2
|
||||||
|
r.left += shrinkAmount
|
||||||
|
r.right -= shrinkAmount
|
||||||
}
|
}
|
||||||
else if(aspectRatio < 0.43) {
|
else if(aspectRatio < 0.43) {
|
||||||
videoSourceHeight = 16;
|
videoSourceHeight = 16;
|
||||||
videoSourceWidth = 9;
|
videoSourceWidth = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
val r = _player.getVideoRect()
|
|
||||||
val playpauseAction = if(_player.playing)
|
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));
|
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
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue