3

After adding compile 'org.webrtc:google-webrtc:1.0.+' to my build.gradle file I try to init PeerConnectionFactory, but this class has no any useful methods.

screenshot

What am I doing wrong?

UPDATE:

enter image description here

2 Answers2

2

The last version org.webrtc:google-webrtc:1.0.21217

You can init by following codes

PeerConnectionFactory.InitializationOptions.Builder optionBuilder = 
    PeerConnectionFactory.InitializationOptions.builder(/* Put context here */);
optionBuilder.setEnableInternalTracer(true);
optionBuilder.setFieldTrials("WebRTC-FlexFEC-03/Enabled/");
optionBuilder.setEnableVideoHwAcceleration(true);
PeerConnectionFactory.initialize(optionBuilder.createInitializationOptions());
firemaples
  • 1,521
  • 13
  • 18
  • `setEnableVideoHwAcceleration` not found in v. 1.0.30039. I'm periodically getting GLES20 error: 1282, was trying disabling hardware acceleration as mentioned here https://stackoverflow.com/questions/47118620/webrtc-application-crash-on-samsung-galaxy-j1-4g, but can't find this parameter anymore. – Mike Keskinov Aug 18 '21 at 17:23
0

First, try to use an specific version like: compile 'org.webrtc:google-webrtc:1.0.20198'

And then make sure you rebuild your project (not only refresh gradle, since it might not be enough for the autocomplete to work).

In your screenshot, it looks like you are trying to autocomplete outside of any method. Since Android Studio tries to only show you valid stuff, it won't display the other methods unless you write it on a valid context (i.e.: inside of some method's implementation).

Logain
  • 4,259
  • 1
  • 23
  • 32