diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2021-05-09 09:56:07 +0300 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2021-05-10 10:24:20 +0300 |
commit | 56535e07ff73a183bd4b8e02edc3700a3e6b4757 (patch) | |
tree | 94c1fe438d7a7febc589305110c71450846940d1 | |
parent | 60c5906fe9e2f60e772da699b598ee0f70f58f31 (diff) |
show black bars in video call when video orientation doesn’t match screen orientation
fixes #4056
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 14 | ||||
-rw-r--r-- | src/main/res/layout/activity_rtp_session.xml | 27 |
2 files changed, 28 insertions, 13 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index e9e12d7e3..ad016a3b3 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -35,6 +35,7 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import org.checkerframework.checker.nullness.compatqual.NullableDecl; +import org.webrtc.RendererCommon; import org.webrtc.SurfaceViewRenderer; import org.webrtc.VideoTrack; @@ -928,7 +929,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe if (END_CARD.contains(state) || state == RtpEndUserState.ENDING_CALL) { binding.localVideo.setVisibility(View.GONE); binding.localVideo.release(); - binding.remoteVideo.setVisibility(View.GONE); + binding.remoteVideoWrapper.setVisibility(View.GONE); binding.remoteVideo.release(); binding.pipLocalMicOffIndicator.setVisibility(View.GONE); if (isPictureInPicture()) { @@ -954,7 +955,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe } if (isPictureInPicture() && (state == RtpEndUserState.CONNECTING || state == RtpEndUserState.ACCEPTING_CALL)) { binding.localVideo.setVisibility(View.GONE); - binding.remoteVideo.setVisibility(View.GONE); + binding.remoteVideoWrapper.setVisibility(View.GONE); binding.appBarLayout.setVisibility(View.GONE); binding.pipPlaceholder.setVisibility(View.VISIBLE); binding.pipWarning.setVisibility(View.GONE); @@ -976,12 +977,17 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe if (remoteVideoTrack.isPresent()) { ensureSurfaceViewRendererIsSetup(binding.remoteVideo); addSink(remoteVideoTrack.get(), binding.remoteVideo); + binding.remoteVideo.setScalingType( + RendererCommon.ScalingType.SCALE_ASPECT_FILL, + RendererCommon.ScalingType.SCALE_ASPECT_FIT + ); if (state == RtpEndUserState.CONNECTED) { binding.appBarLayout.setVisibility(View.GONE); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + binding.remoteVideoWrapper.setVisibility(View.VISIBLE); } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - binding.remoteVideo.setVisibility(View.GONE); + binding.remoteVideoWrapper.setVisibility(View.GONE); } if (isPictureInPicture() && !requireRtpConnection().isMicrophoneEnabled()) { binding.pipLocalMicOffIndicator.setVisibility(View.VISIBLE); @@ -990,7 +996,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe } } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - binding.remoteVideo.setVisibility(View.GONE); + binding.remoteVideoWrapper.setVisibility(View.GONE); binding.pipLocalMicOffIndicator.setVisibility(View.GONE); } } diff --git a/src/main/res/layout/activity_rtp_session.xml b/src/main/res/layout/activity_rtp_session.xml index a14e899c7..26fa4d496 100644 --- a/src/main/res/layout/activity_rtp_session.xml +++ b/src/main/res/layout/activity_rtp_session.xml @@ -86,6 +86,24 @@ </RelativeLayout> + + <LinearLayout + android:id="@+id/remote_video_wrapper" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_below="@+id/app_bar_layout" + android:layout_alignParentStart="true" + android:layout_alignParentBottom="true" + android:background="@color/black" + android:gravity="center" + android:visibility="gone"> + + <org.webrtc.SurfaceViewRenderer + android:id="@+id/remote_video" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </LinearLayout> + <org.webrtc.SurfaceViewRenderer android:id="@+id/local_video" android:layout_width="@dimen/local_video_preview_width" @@ -97,15 +115,6 @@ android:visibility="gone" app:elevation="4dp" /> - <org.webrtc.SurfaceViewRenderer - android:id="@+id/remote_video" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_below="@+id/app_bar_layout" - android:layout_alignParentStart="true" - android:layout_alignParentBottom="true" - android:visibility="gone" /> - <ImageView android:id="@+id/verified" android:layout_width="wrap_content" |