# Way to set loud speaker for webrtc

**URL:** <https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391>\
**Category:** Uncategorized\
**Created:** [November 29, 2019, 8:45am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391 "2019-11-29T08:45:16Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![xerex](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/xerex/32/118_2.png) [@xerex](https://react-native-webrtc.discourse.group/u/xerex)\
**Post date:** [November 29, 2019, 8:45am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/1 "2019-11-29T08:45:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![saghul](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/saghul/32/4_2.png) [@saghul](https://react-native-webrtc.discourse.group/u/saghul)\
**Post date:** [November 29, 2019, 9:24am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/2 "2019-11-29T09:24:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xerex](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/xerex/32/118_2.png) [@xerex](https://react-native-webrtc.discourse.group/u/xerex)\
**Post date:** [November 29, 2019, 9:35am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/3 "2019-11-29T09:35:11Z")

</div>

can you explain more ?

---

<div class="post-metadata">

**Author:** ![saghul](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/saghul/32/4_2.png) [@saghul](https://react-native-webrtc.discourse.group/u/saghul)\
**Post date:** [November 29, 2019, 9:37am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/4 "2019-11-29T09:37:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![moonjava](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/moonjava/32/99_2.png) [@moonjava](https://react-native-webrtc.discourse.group/u/moonjava)\
**Post date:** [December 31, 2019, 8:06am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/5 "2019-12-31T08:06:02Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![saghul](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/saghul/32/4_2.png) [@saghul](https://react-native-webrtc.discourse.group/u/saghul)\
**Post date:** [January 8, 2020, 8:14am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/6 "2020-01-08T08:14:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![alejinho](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/alejinho/32/232_2.png) [@alejinho](https://react-native-webrtc.discourse.group/u/alejinho)\
**Post date:** [March 29, 2020, 12:59am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/7 "2020-03-29T00:59:10Z")

</div>

Any idea about how to solve this situation?

---

<div class="post-metadata">

**Author:** ![bwoodlt](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/bwoodlt/32/464_2.png) [@bwoodlt](https://react-native-webrtc.discourse.group/u/bwoodlt)\
**Post date:** [June 13, 2021, 11:18am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/8 "2021-06-13T11:18:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jbaudanza](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/jbaudanza/32/387_2.png) [@jbaudanza](https://react-native-webrtc.discourse.group/u/jbaudanza)\
**Post date:** [June 20, 2021, 5:28am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/9 "2021-06-20T05:28:31Z")

</div>

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

```auto

#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 | 
    AVAudioSessionCategoryOptionDefaultToSpeaker
  );
  
  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](https://chromium.googlesource.com/external/webrtc/+/refs/heads/master/examples/androidapp/src/org/appspot/apprtc/AppRTCAudioManager.java)

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

---

<div class="post-metadata">

**Author:** ![flhember](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/flhember/32/536_2.png) [@flhember](https://react-native-webrtc.discourse.group/u/flhember)\
**Post date:** [February 21, 2022, 2:15pm UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/10 "2022-02-21T14:15:12Z")

</div>

> [@jbaudanza](#):
>
> `RTCAudioSessionConfiguration.h`

Hi,  
I don’t understand how to apply your solution,  
RTCAudioSessionConfiguration.h doesn’t existe 😕  
Is it possible to have more information?  
Thanks !

---

<div class="post-metadata">

**Author:** ![jbaudanza](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/jbaudanza/32/387_2.png) [@jbaudanza](https://react-native-webrtc.discourse.group/u/jbaudanza)\
**Post date:** [March 5, 2022, 5:04pm UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/11 "2022-03-05T17:04:21Z")

</div>

This file is part of WebRTC.framework, which should be automatically linked when you install react-native-webrtc.

---

<div class="post-metadata">

**Author:** ![ctoppel](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/ctoppel/32/641_2.png) [@ctoppel](https://react-native-webrtc.discourse.group/u/ctoppel)\
**Post date:** [August 19, 2022, 10:58pm UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/12 "2022-08-19T22:58:16Z")

</div>

Thank you @jbaudanza as it helped us get the iOS side situated. For Android, we were able to default to speakerphone in a bit of a hacky way (at least for now) that was fairly easy to do.

First we added code to the MainApplication.java file in the onCreate() function:

Add this import to the top of the file:

```auto
import android.media.AudioManager;

```

Then modify onCreate()

```auto
  @Override
  public void onCreate() {
    // Your other content...

    AudioManager manager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    if (manager != null) {
      manager.setSpeakerphoneOn(true);
    }
  }

```

Lastly you will need to add the following to AndroidManifest.xml:

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

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![sstatsuya](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/sstatsuya/32/789_2.png) [@sstatsuya](https://react-native-webrtc.discourse.group/u/sstatsuya)\
**Post date:** [January 23, 2024, 8:16am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/13 "2024-01-23T08:16:28Z")

</div>

On new version of react-native-webrtc (111.0.6), RTCAudioSessionConfiguration was removed. So do you have any solution?

---

<div class="post-metadata">

**Author:** ![victormongi](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/victormongi/32/844_2.png) [@victormongi](https://react-native-webrtc.discourse.group/u/victormongi)\
**Post date:** [August 28, 2024, 9:02am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/14 "2024-08-28T09:02:36Z")

</div>

Thank you you saved my days…

---

<div class="post-metadata">

**Author:** ![victormongi](https://yyz2.discourse-cdn.com/free1/user_avatar/react-native-webrtc.discourse.group/victormongi/32/844_2.png) [@victormongi](https://react-native-webrtc.discourse.group/u/victormongi)\
**Post date:** [September 4, 2024, 4:01am UTC](https://react-native-webrtc.discourse.group/t/way-to-set-loud-speaker-for-webrtc/391/15 "2024-09-04T04:01:34Z")

</div>

> [@jbaudanza](#):
>
> AppRTC

Do you have any example using new expo version? it using kotlin instead java,  
Thank you
