i previously used WebRTC 1.0.22672
, now i switched to last version 1.0.26885
.
previously i used this code to create PeerConnectionFactory And VideoSource Object and it worked fine:
PeerConnectionFactory.InitializationOptions initializationOptions =
PeerConnectionFactory.InitializationOptions.builder(this)
.createInitializationOptions();
PeerConnectionFactory.initialize(initializationOptions);
//Create a new PeerConnectionFactory instance - using Hardware encoder and decoder.
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
DefaultVideoEncoderFactory defaultVideoEncoderFactory = new DefaultVideoEncoderFactory(
rootEglBase.getEglBaseContext(), /* enableIntelVp8Encoder */true, /* enableH264HighProfile */true);
DefaultVideoDecoderFactory defaultVideoDecoderFactory = new DefaultVideoDecoderFactory(rootEglBase.getEglBaseContext());
peerConnectionFactory = new PeerConnectionFactory(options, defaultVideoEncoderFactory, defaultVideoDecoderFactory);
//Now create a VideoCapturer instance.
VideoCapturer videoCapturerAndroid;
videoCapturerAndroid = createCameraCapturer(new Camera1Enumerator(false));
//Create MediaConstraints - Will be useful for specifying video and audio constraints.
audioConstraints = new MediaConstraints();
videoConstraints = new MediaConstraints();
//Create a VideoSource instance
if (videoCapturerAndroid != null) {
videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid);
}
but in latest version i have two errors on new PeerConnectionFactory...
that says:
'PeerConnectionFactory(long)' is not public in 'org.webrtc.PeerConnectionFactory'. Cannot be accessed from outside package
and on peerConnectionFactory.createVideoSource...
that syas:
createVideoSource (boolean) in PeerConnectionFactory cannot be applied to (org.webrtc.VideoCapturer)
How can i solve these errors?
and can someone tell my WHY there is no documentation or change-log for android native WebRTC?!
How can i solve these errors?
There are many APIs has been deprecated or removed from WebRTC newest version. Please do the following steps to resolve those errors.
Step 1: Change your code from
peerConnectionFactory = new PeerConnectionFactory(options, defaultVideoEncoderFactory, defaultVideoDecoderFactory);
to
peerConnectionFactory = PeerConnectionFactory.builder()
.setOptions(options)
.setVideoEncoderFactory(defaultVideoEncoderFactory)
.setVideoDecoderFactory(defaultVideoDecoderFactory)
.createPeerConnectionFactory();
Step 2: Change your code from
//Create a VideoSource instance
if (videoCapturerAndroid != null) {
videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid);
}
to
//Create a VideoSource instance
if (videoCapturerAndroid != null) {
SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create("CaptureThread", rootEglBase.getEglBaseContext());
videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid.isScreencast());
videoCapturerAndroid.initialize(surfaceTextureHelper, getApplicationContext(), videoSource.getCapturerObserver());
}
Can someone tell my WHY there is no documentation or change-log for android native WebRTC?
The change log is at
https://webrtc.googlesource.com/src/+log
Note: About your problems, you can follow the below link for more details.
https://groups.google.com/forum/#!topic/discuss-webrtc/gwJP5Sf0cdE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With