Partly fix notifications

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-05-29 14:34:37 +02:00
parent 3d41e926a3
commit ae8057e405
2 changed files with 33 additions and 11 deletions

View file

@ -501,9 +501,9 @@ public class CallActivity extends AppCompatActivity {
if (b && cameraSwitchCount != -1) { if (b && cameraSwitchCount != -1) {
if (cameraSwitchCount == camerasCount) { if (cameraSwitchCount == camerasCount) {
cameraSwitchCount = 0; cameraSwitchCount = 0;
pipVideoView.setMirror(true);
} else {
pipVideoView.setMirror(false); pipVideoView.setMirror(false);
} else {
pipVideoView.setMirror(true);
} }
} }
} }
@ -688,7 +688,7 @@ public class CallActivity extends AppCompatActivity {
//Create a new PeerConnectionFactory instance. //Create a new PeerConnectionFactory instance.
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
peerConnectionFactory = new PeerConnectionFactory(options); peerConnectionFactory = PeerConnectionFactory.builder().createPeerConnectionFactory();
peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(), peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(),
rootEglBase.getEglBaseContext()); rootEglBase.getEglBaseContext());
@ -745,11 +745,7 @@ public class CallActivity extends AppCompatActivity {
localMediaStream.addTrack(localVideoTrack); localMediaStream.addTrack(localVideoTrack);
localVideoTrack.setEnabled(false); localVideoTrack.setEnabled(false);
//create a videoRenderer based on SurfaceViewRenderer instance localVideoTrack.addSink(pipVideoView);
localRenderer = new VideoRenderer(pipVideoView);
// And finally, with our VideoRenderer ready, we
// can add our renderer to the VideoTrack.
localVideoTrack.addRenderer(localRenderer);
} }
} }
@ -1405,8 +1401,7 @@ public class CallActivity extends AppCompatActivity {
if (mediaStream != null && mediaStream.videoTracks != null && mediaStream.videoTracks.size() > 0 && enable) { if (mediaStream != null && mediaStream.videoTracks != null && mediaStream.videoTracks.size() > 0 && enable) {
VideoTrack videoTrack = mediaStream.videoTracks.get(0); VideoTrack videoTrack = mediaStream.videoTracks.get(0);
VideoRenderer remoteRenderer = new VideoRenderer(surfaceViewRenderer); videoTrack.addSink(surfaceViewRenderer);
videoTrack.addRenderer(remoteRenderer);
imageView.setVisibility(View.INVISIBLE); imageView.setVisibility(View.INVISIBLE);
surfaceViewRenderer.setVisibility(View.VISIBLE); surfaceViewRenderer.setVisibility(View.VISIBLE);

View file

@ -405,7 +405,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
inChat = false; inChat = false;
dispose(); dispose();
ApplicationWideCurrentRoomHolder.getInstance().clear(); ApplicationWideCurrentRoomHolder.getInstance().clear();
super.onDestroy(); leaveRoom();
} }
private void dispose() { private void dispose() {
@ -488,6 +488,33 @@ public class ChatController extends BaseController implements MessagesListAdapte
} }
} }
private void leaveRoom() {
ncApi.leaveRoom(credentials, ApiUtils.getUrlForRoomParticipants(baseUrl, roomToken))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<GenericOverall>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(GenericOverall genericOverall) {
getRouter().popCurrentController();
}
@Override
public void onError(Throwable e) {
}
@Override
public void onComplete() {
}
});
}
private void setSenderId() { private void setSenderId() {
try { try {
final Field senderId = adapter.getClass().getDeclaredField("senderId"); final Field senderId = adapter.getClass().getDeclaredField("senderId");