allow pip during connecting

This commit is contained in:
Daniel Gultsch 2020-04-17 11:44:20 +02:00
parent 2f437ea845
commit ab2681640a
2 changed files with 27 additions and 2 deletions

View file

@ -299,7 +299,11 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
private boolean shouldBePictureInPicture() { private boolean shouldBePictureInPicture() {
try { try {
final JingleRtpConnection rtpConnection = requireRtpConnection(); final JingleRtpConnection rtpConnection = requireRtpConnection();
return rtpConnection.getMedia().contains(Media.VIDEO) && rtpConnection.getEndUserState() == RtpEndUserState.CONNECTED; return rtpConnection.getMedia().contains(Media.VIDEO) && Arrays.asList(
RtpEndUserState.ACCEPTING_CALL,
RtpEndUserState.CONNECTING,
RtpEndUserState.CONNECTED
).contains(rtpConnection.getEndUserState());
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
return false; return false;
} }
@ -546,8 +550,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
binding.pipPlaceholder.setVisibility(View.VISIBLE); binding.pipPlaceholder.setVisibility(View.VISIBLE);
if (state == RtpEndUserState.APPLICATION_ERROR || state == RtpEndUserState.CONNECTIVITY_ERROR) { if (state == RtpEndUserState.APPLICATION_ERROR || state == RtpEndUserState.CONNECTIVITY_ERROR) {
binding.pipWarning.setVisibility(View.VISIBLE); binding.pipWarning.setVisibility(View.VISIBLE);
binding.pipWaiting.setVisibility(View.GONE);
} else { } else {
binding.pipWarning.setVisibility(View.GONE); binding.pipWarning.setVisibility(View.GONE);
binding.pipWaiting.setVisibility(View.GONE);
} }
} else { } else {
binding.appBarLayout.setVisibility(View.VISIBLE); binding.appBarLayout.setVisibility(View.VISIBLE);
@ -556,6 +562,15 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
return; return;
} }
if (isPictureInPicture() && (state == RtpEndUserState.CONNECTING || state == RtpEndUserState.ACCEPTING_CALL)) {
binding.localVideo.setVisibility(View.GONE);
binding.remoteVideo.setVisibility(View.GONE);
binding.appBarLayout.setVisibility(View.GONE);
binding.pipPlaceholder.setVisibility(View.VISIBLE);
binding.pipWarning.setVisibility(View.GONE);
binding.pipWaiting.setVisibility(View.VISIBLE);
return;
}
final Optional<VideoTrack> localVideoTrack = requireRtpConnection().geLocalVideoTrack(); final Optional<VideoTrack> localVideoTrack = requireRtpConnection().geLocalVideoTrack();
if (localVideoTrack.isPresent() && !isPictureInPicture()) { if (localVideoTrack.isPresent() && !isPictureInPicture()) {
ensureSurfaceViewRendererIsSetup(binding.localVideo); ensureSurfaceViewRendererIsSetup(binding.localVideo);

View file

@ -17,11 +17,21 @@
android:orientation="horizontal" android:orientation="horizontal"
android:visibility="gone"> android:visibility="gone">
<ProgressBar
android:id="@+id/pip_waiting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:indeterminateOnly="true"
android:indeterminateTint="@color/white"
android:visibility="gone" />
<ImageView <ImageView
android:id="@+id/pip_warning" android:id="@+id/pip_warning"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/ic_warning_white_48dp" /> android:src="@drawable/ic_warning_white_48dp"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout