I am working on pjsip video calling app. I want to switch preview camera in an ongoing call.
Here is the code that I am trying.
private void switchCamera(boolean isFront) {
try {
int w = (int) SipCallService.currentCall.vidPrev.getVideoWindow()
.getInfo().getSize().getW();
int h = (int) SipCallService.currentCall.vidPrev.getVideoWindow()
.getInfo().getSize().getH();
if (isFront) {
PjCamera camera = new PjCamera(0, w, h, 0, 0, 0,
mSurfaceCapture);
camera.SwitchDevice(0);
} else {
PjCamera camera = new PjCamera(0, w, h, 0, 0, 0,
mSurfaceCapture);
camera.SwitchDevice(1);
}
} catch (Exception e) {
e.printStackTrace();
showToast("Error while switching camera");
}
}
PjCamera is the class provided by pjsip.
I am not able to switch camera using above code.
If there is any other method please guide me to it.