phonertc
phonertc copied to clipboard
Change camera direction?
Hello, how do one change to the back-facing camera? Now it's only the front camera.
Dear @alongubkin, I was stuck with that too.. My app is almost ready and During the final stage i found, I cannot use the Back Facing Camera..:(. Its good to see you have it for enhancement..How long will it take?..
For quick fix as My app will only use the back facing camera. I switched the cameraFacing, cameraIndex as below in PhoneRTCPlugin.java for android and for iOS i see the # TODO comment in line number 200 in PhoneRTCPlugin.swift so may work if we change the AVCaptureDevicePosition.Front to AVCaptureDevicePosition.Back but not sure as i dont know any thing about swift :) This solution if only the app will use the back facing camera and my app only use the back facing camera..
private VideoCapturer getVideoCapturer() {
String[] cameraFacing = { "back", "front" };
int[] cameraIndex = { 1, 0 };
int[] cameraOrientation = { 0, 90, 180, 270 };
for (String facing : cameraFacing) {
for (int index : cameraIndex) {
for (int orientation : cameraOrientation) {
String name = "Camera " + index + ", Facing " + facing +
", Orientation " + orientation;
VideoCapturer capturer = VideoCapturer.create(name);
if (capturer != null) {
// logAndToast("Using camera: " + name);
return capturer;
}
}
}
}
throw new RuntimeException("Failed to open capturer");
}
+1