Facing this issue while implementing WebRTC in Android:
Caused by: java.lang.RuntimeException: CameraCapturer must be initialized before calling startCapture.
build.gradle(:app)
dependencies {
......
implementation 'org.webrtc:google-webrtc:1.0.+'
......
}
// Chunk causing problem:
private void getVideoSource() {
// isScreenCast = false
videoSource = peerConnectionFactory.createVideoSource(false);
surfaceTextureHelper = SurfaceTextureHelper.create(Thread.currentThread().getName(), rootEglBase.getEglBaseContext());
VideoCapturer videoCapturer = createCameraCapturer(new Camera1Enumerator(false));
localVideoTrack = peerConnectionFactory.createVideoTrack("200", videoSource);
localVideoTrack.addSink(local_renderer);
if(videoCapturer != null)
videoCapturer.startCapture(1000,1000,30); // <- Here is the Exception
}
CameraCapturer is deprecated. There is Camera1Capturer now available.