Hello,
I am trying to understand the documentation of switching cameras. By understading, I mean trying to implement it in OpvenVidu-Andriod Demo.
For more than a week I have been stuck on this. I dont quite coperhand the documentation. What I have noticed, but correct me if I am wrong, the documentation is made for the whole OpenVidu, not exactly for Android version or whatever.
Can someone point me, more exactly, what do I need to do, so I can switch cameras but not disconnecting from the session.
What I have tried, maybe pointless and off topic (have a normal switch in activity_main.xml) - in SessionActivity, in function getTokenSuccess:
localParticipant.startCamera(false);
Switch onOffSwitch = (Switch) findViewById(R.id.cameraSwitch);
onOffSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
Log.v("Switch State= ", ""+isChecked);
localParticipant.startCamera(isChecked);
});
And then in localParticipant I have started to work with createCameraCapturer (passing the isChecked from the switch via startCamera)
for(String deviceName : deviceNames){
if(!switchCamera){
if (enumerator.isFrontFacing(deviceName)) {
videoCapturer = enumerator.createCapturer(deviceName, null);
if (videoCapturer != null) {
return videoCapturer;
}
}
}else{
if (enumerator.isBackFacing(deviceName)) {
videoCapturer = enumerator.createCapturer(deviceName, null);
if (videoCapturer != null) {
return videoCapturer;
}
}
}
}
return null;
Also from what I read online, I need to release the camera somehow; I saw that in Camera2Enumerator, it’s calling some CameraManager functions from android api. But that file is readonly.
Either way, if someone has a good example or can point me in the right direction. I would be gratefull.
Also, I have read something about publishers too, but again, I cannot see how they are implemented in OpenVidu-Android.
Thank you a lot!