2

with google webrtc I've been facing this issue and this is the code for creating a video source

private VideoTrack getVideoTrack() {
    this.capturer = createCapturer();
    return factory.createVideoTrack("video1", factory.createVideoSource(this.capturer));
}

but I'm getting an error

'createVideoSource(boolean)' in 'org.webrtc.PeerConnectionFactory' cannot be applied to '(org.webrtc.CameraVideoCapturer)'

any idea on why its giving an error?

thanks.

Shweta Chauhan
  • 6,739
  • 6
  • 37
  • 57
MetalSaint
  • 53
  • 10
  • This seems like a dependency version problem. Can you show us your build.gradle of the module? – JensV Nov 12 '19 at 13:43
  • in another function where its PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions.builder(c).createInitializationOptions()); factory = PeerConnectionFactory.builder().createPeerConnectionFactory(); – MetalSaint Nov 12 '19 at 13:44
  • I've switched to an older version of webrtc but no luck as all the code is based on the new version even online i found examples but its still gives error, also gradle is 3.1.3 dependencies { implementation 'com.google.zxing:core:3.4.0' implementation 'org.webrtc:google-webrtc:1.0.28513' – MetalSaint Nov 12 '19 at 13:47
  • https://github.com/meshenger-app/meshenger-android/blob/master/app/src/main/java/d/d/meshenger/RTCCall.java the code on github – MetalSaint Nov 12 '19 at 13:51
  • Where exactly do you see the error? At runtime? – JensV Nov 12 '19 at 16:07
  • As far as my research goes, the signature `createVideoSource(boolean)` has never existed. So the error you are getting is indeed strange. Do you have a full stacktrace? Is capturer null? – JensV Nov 12 '19 at 16:09
  • Thank you @JensV I fixed it and posted the answer below. – MetalSaint Nov 13 '19 at 11:12

1 Answers1

1

Well, I fixed after 10 hours,

the fix is changing the code to

private VideoTrack getVideoTrack() {
    this.capturer = createCapturer();
    assert this.capturer != null;
    return factory.createVideoTrack("video1", factory.createVideoSource(this.capturer.isScreencast()));
}

and then initializing

capturer = new CameraVideoCapturer()

that fixed it

MetalSaint
  • 53
  • 10