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() {
try {
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) {
return false;
}
@ -546,8 +550,10 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
binding.pipPlaceholder.setVisibility(View.VISIBLE);
if (state == RtpEndUserState.APPLICATION_ERROR || state == RtpEndUserState.CONNECTIVITY_ERROR) {
binding.pipWarning.setVisibility(View.VISIBLE);
binding.pipWaiting.setVisibility(View.GONE);
} else {
binding.pipWarning.setVisibility(View.GONE);
binding.pipWaiting.setVisibility(View.GONE);
}
} else {
binding.appBarLayout.setVisibility(View.VISIBLE);
@ -556,6 +562,15 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
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();
if (localVideoTrack.isPresent() && !isPictureInPicture()) {
ensureSurfaceViewRendererIsSetup(binding.localVideo);

View file

@ -17,11 +17,21 @@
android:orientation="horizontal"
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
android:id="@+id/pip_warning"
android:layout_width="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>
<android.support.design.widget.AppBarLayout