Rahul Patidar
Rahul Patidar

Reputation: 406

Unable to open camera service in WebRTC Video calling

I am developing an Android application for text chat, voice and video call using this link click here. All the things are working fine except rendering my own video. Due to this, opponent is unable to see my video on his/her device.

Following is the logcat detail

E/VideoCapturerAndroid: VideoCapturerAndroid: Camera.open failed, retrying
E/VideoCapturerAndroid: VideoCapturerAndroid: java.lang.RuntimeException: Fail to connect to camera service
E/VideoCapturerAndroid: VideoCapturerAndroid: java.lang.RuntimeException: Fail to connect to camera service
                                                                           at android.hardware.Camera.native_setup(Native Method)
                                                                           at android.hardware.Camera.<init>(Camera.java:352)
                                                                           at android.hardware.Camera.open(Camera.java:309)
                                                                           at org.webrtc.VideoCapturerAndroid.startCaptureOnCameraThread(VideoCapturerAndroid.java:434)
                                                                           at org.webrtc.VideoCapturerAndroid.access$1000(VideoCapturerAndroid.java:65)
                                                                           at org.webrtc.VideoCapturerAndroid$7.run(VideoCapturerAndroid.java:409)
                                                                           at android.os.Handler.handleCallback(Handler.java:733)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                           at android.os.Looper.loop(Looper.java:136)
                                                                           at android.os.HandlerThread.run(HandlerThread.java:61)
                                                                           01-02 20:29:28.338 25073-15599/com.inn.kurento I/libjingle: (opensslidentity.cc:88): Returning key pair

I have tried so many things but still not able to fix the issue. Any help is appreciated. Thanks in advance.

Upvotes: 1

Views: 744

Answers (1)

Rahul Jain
Rahul Jain

Reputation: 276

Try this one, works for me.

void close(){
        // Uncomment only if you know what you are doing
        try {
            localMediaStream.dispose();
            localMediaStream = null;
            if(videoCapturer!=null){
                videoCapturer.dispose();
            }
            videoCapturer = null;
            videoSource.stop(); //very important
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Upvotes: 1

Related Questions