I'm trying to take a picture while there's an ongoing OpenTok video conference in an Android application. I use OpenTok SDK 2.0 for Android.
I tried to use publisher.setPublishVideo(false) to temporarily free the Camera so that the default Camera Activity can be used to take a picture. But looks like OpenTok does not free the Camera hardware.
As a workaround I tried using session.unpublish(publisher), which frees the Camera (and it also cuts the audio stream which is not desirable for me) but once I'm done with taking a picture, this time the a/v is not restored with session.publish(publisher).
Any help on this?
Late response, but figured this may help for anyone who comes across the same issue.
My solution was to destroy capturer prior to starting intent to take picture
mPublisher.setPublishVideo(false);
BaseVideoCapturer bvc = mPublisher.getCapturer();
if(bvc != null){
bvc.destroy();
}
//intent to start picture capture (Ex. ACTION_IMAGE_CAPTURE)
When you resume after taking the picture, you will need to initialize again
BaseVideoCapturer bvc = mPublisher.getCapturer();
if(bvc != null){
if(bvc.isCaptureStarted() == false){
bvc.init();
bvc.startCapture();
mPublisher.setPublishVideo(true);
}
}