phonertc icon indicating copy to clipboard operation
phonertc copied to clipboard

Change camera direction?

Open albinekb opened this issue 9 years ago • 3 comments

Hello, how do one change to the back-facing camera? Now it's only the front camera.

albinekb avatar Sep 15 '15 12:09 albinekb

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?..

zzzet avatar Oct 14 '15 05:10 zzzet

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");
    }

zzzet avatar Oct 14 '15 11:10 zzzet

+1

sentiasa avatar Nov 18 '15 20:11 sentiasa