diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 3cbf0e51c..8b0cbd6f1 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -62,6 +62,7 @@ android:networkSecurityConfig="@xml/network_security_configuration" android:theme="@style/ConversationsTheme" tools:replace="android:label" + android:hardwareAccelerated="true" tools:targetApi="o"> localVideoTrack = requireRtpConnection().geLocalVideoTrack(); if (localVideoTrack.isPresent()) { - try { - binding.localVideo.init(requireRtpConnection().getEglBaseContext(), null); - } catch (IllegalStateException e) { - Log.d(Config.LOGTAG,"ignoring already init for now",e); - } - binding.localVideo.setEnableHardwareScaler(true); + ensureSurfaceViewRendererIsSetup(binding.localVideo); + //paint local view over remote view + binding.localVideo.setZOrderMediaOverlay(true); binding.localVideo.setMirror(true); localVideoTrack.get().addSink(binding.localVideo); + } else { + binding.localVideo.setVisibility(View.GONE); } final Optional remoteVideoTrack = requireRtpConnection().getRemoteVideoTrack(); if (remoteVideoTrack.isPresent()) { - try { - binding.remoteVideo.init(requireRtpConnection().getEglBaseContext(), null); - } catch (IllegalStateException e) { - Log.d(Config.LOGTAG,"ignoring already init for now",e); - } - binding.remoteVideo.setEnableHardwareScaler(true); + ensureSurfaceViewRendererIsSetup(binding.remoteVideo); remoteVideoTrack.get().addSink(binding.remoteVideo); + } else { + binding.remoteVideo.setVisibility(View.GONE); } } + private void ensureSurfaceViewRendererIsSetup(final SurfaceViewRenderer surfaceViewRenderer) { + surfaceViewRenderer.setVisibility(View.VISIBLE); + try { + surfaceViewRenderer.init(requireRtpConnection().getEglBaseContext(), null); + } catch (IllegalStateException e) { + Log.d(Config.LOGTAG, "SurfaceViewRenderer was already initialized"); + } + surfaceViewRenderer.setEnableHardwareScaler(true); + } + private void updateStateDisplay(final RtpEndUserState state) { switch (state) { case INCOMING_CALL: @@ -484,7 +490,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe final Account account = extractAccount(intent); final Jid with = Jid.of(intent.getStringExtra(EXTRA_WITH)); this.rtpConnectionReference = null; - proposeJingleRtpSession(account, with, ImmutableSet.of(Media.AUDIO)); + proposeJingleRtpSession(account, with, ImmutableSet.of(Media.AUDIO, Media.VIDEO)); } private void exit(View view) { diff --git a/src/main/res/layout/activity_rtp_session.xml b/src/main/res/layout/activity_rtp_session.xml index 3b1390db6..a9b279334 100644 --- a/src/main/res/layout/activity_rtp_session.xml +++ b/src/main/res/layout/activity_rtp_session.xml @@ -35,16 +35,6 @@ - - + android:visibility="gone" /> + +