Garande
Garande

Reputation: 192

How to increase the sound Volume Output in Webrtc

Am working on a webrtc android application and everything is working fine except two things... which are;

  1. switching the default sound output device from the Earpiece to Speaker and vice versa.. I have tried to use the code below from this stackoverflow thread but they are not working
audioManager = (AudioManager) this.activity.getSystemService(Context.AUDIO_SERVICE);
audioManager.setSpeakerphoneOn(true);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
  1. And improving the video performance, there is a lot of lagging in the video streams where even the stream hangs a lot. if there is any one who can help me on this too thanks a lot. Below is my peerConnection configs
String fieldTrials = (PeerConnectionFactory.VIDEO_FRAME_EMIT_TRIAL + "/" + PeerConnectionFactory.TRIAL_ENABLED + "/");
PeerConnectionFactory.InitializationOptions initializationOptions =
                PeerConnectionFactory.InitializationOptions.builder(this)
                        .setFieldTrials(fieldTrials)
                        .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 = PeerConnectionFactory.builder()
                .setOptions(options)
                .setVideoEncoderFactory(defaultVideoEncoderFactory)
                .setVideoDecoderFactory(defaultVideoDecoderFactory)
                .createPeerConnectionFactory();

Thanks

Upvotes: 0

Views: 1878

Answers (1)

Jeremy Huang
Jeremy Huang

Reputation: 31

Need add this permission in manifest

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

Upvotes: 1

Related Questions