Closed lby1992 closed 7 years ago
Hi @lby1992,
What device model are you using?
hi, @marinaserranomontes, this occur on each my device, I think it's caused by the incorrect code. I have adjusted my code, now it seems working fine:
BaseVideoCapturer capturer = livePublisher.getCapturer();
if (capturer.isCaptureStarted()) {
capturer.stopCapture();
}
capturer.destroy();
livePublisher.cycleCamera();
capturer.init();
capturer.startCapture();
If it's the correct way to toggle camera
hi @lby1992 ,
You don't need to manage the capturer if you want to cycle the camera. If the publisher exists, you should only call the publisher.cycleCamera() and it should work. You can find an example here: https://github.com/opentok/opentok-android-sdk-samples/blob/bdec9e5d14549134c75b28d89f500d921f08d53d/Simple-Multiparty/app/src/main/java/com/tokbox/android/tutorials/simple_multiparty/MainActivity.java#L60
@marinaserranomontes I just called the same as sample code before, but it crashed. I search on Google with the exception message, and then manage the capturer by myself.
@lby1992 just to reproduce and debug it, please, could you detail the Android versions and device models you are using, please? Thanks!!
hi @marinaserranomontes , below models I am using:
1.ZTE N958St
, api 19
2.Emulator Nexus_5x_API_24
I am looking for more device to try this
Hi @lby1992 ,
I am not able to reproduce it with the emulator and API 24. We are working on the possible camera swap exceptions for the next release.
Thanks for your feedback.
@marinaserranomontes Ok, thanks for your help.
Hi, I have a problem of camera toggle. I provide a button to toggle camera. When user was publishing and clicked the
toggle camera
button, app crashes.below is my code:
and the crash logs:
sdk version is
2.11.0
, my phone has two camerashope someone help me, thanks