Way to set loud speaker for webrtc

I want to set react-native-webrtc to phone speaker
now when i call my stream sound play in earphone
please help me

You can do it with this plugin: https://github.com/react-native-webrtc/react-native-incall-manager

can you explain more ?

Please read its documentation: https://github.com/react-native-webrtc/react-native-incall-manager#api

Hi all,
With “react-native-incall-manager”, we only can set “On” the “phone speaker” not (internal speaker). It means the sound like the voice call with speaker on. When you press the volume, the current audio mode is not the media volume. That’s why the quality of sound so pure and we need to control when users plugin the headphone too.
As I asked in another thread, there’s any way to change audio stream in “STREAM_MUSIC” instead of “STREAM_VOICE_CALL”

I believe there is, but you will need to modify the plugin yourself. IIRC something could be set on the audio track instance.

Any idea about how to solve this situation?

1 Like

Hey guys, were you able to fix this issue? I’m having the same issue @moonjava @saghul though im not using react-native-incall-manager yet. Still using just react-native-webrtc

On iOS, this is really simple. Inside your AppDelegate.m, do something like this:

#import <WebRTC/RTCAudioSessionConfiguration.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  // Probably do other initialization stuff..

  // tell libwebrtc how to configure the app's AVAudioSession singleton
  RTCAudioSessionConfiguration *webRTCConfiguration = [RTCAudioSessionConfiguration webRTCConfiguration];

  webRTCConfiguration.categoryOptions = (
     AVAudioSessionCategoryOptionAllowBluetooth | 
  return YES;

If this is all you need, I wouldn’t recommend react-native-incall-manager. It’s overkill.

If you need to support Android, it’s a bit more complicated. I ended up copying some sample code from AppRTC that’s available here: examples/androidapp/src/org/appspot/apprtc/AppRTCAudioManager.java - external/webrtc - Git at Google

I believe this is the code that react-native-incall-manager was originally based on.