Skip to content

Commit

Permalink
docs(react-native): move incallmanager tip to appropriate location (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede authored Aug 29, 2023
1 parent 3e10c08 commit 9e69202
Showing 1 changed file with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,31 @@ const styles = StyleSheet.create({

</Tabs>

:::info
By default, the audio source is set to the device's speaker.
However, if you wish for the app to seamlessly switch between the earphone and speaker,
you can make use of the `useIncallManager` hook provided by the SDK. This hook internally utilizes
[react-native-incall-manager](https://github.com/react-native-webrtc/react-native-incall-manager#usage) library for this purpose.

```tsx title="src/ToggleMicButton.tsx"

import {
...
// highlight-next-line
useIncallManager,
} from '@stream-io/video-react-native-sdk';

export const ToggleMicButton = () => {
// start incall manager
// Please read more about `media` and `auto` options in the documentation of react-native-incall-manager
// https://github.com/react-native-webrtc/react-native-incall-manager#usage
// highlight-next-line
useIncallManager({media: 'video', auto: true});
...
}
```
:::

If you refresh the app, you should be able to toggle live mode and mute/unmute the microphone.

![Preview of the audio room UI](../assets/02-tutorials/02-audio-room/active-room-controls.png)
Expand Down Expand Up @@ -1249,31 +1274,6 @@ export const ToggleMicButton = () => {
};
```

:::info
By default, the audio source is set to the device's speaker.
However, if you wish for the app to seamlessly switch between the earphone and speaker,
you can make use of the `useIncallManager` hook provided by the SDK. This hook internally utilizes
[react-native-incall-manager](https://github.com/react-native-webrtc/react-native-incall-manager#usage) library for this purpose.

```tsx title="src/ToggleMicButton.tsx"

import {
...
// highlight-next-line
useIncallManager,
} from '@stream-io/video-react-native-sdk';

export const ToggleMicButton = () => {
// start incall manager
// Please read more about `media` and `auto` options in the documentation of react-native-incall-manager
// https://github.com/react-native-webrtc/react-native-incall-manager#usage
// highlight-next-line
useIncallManager({media: 'video', auto: true});
...
}
```
:::

Let's proceed to add an event listener for the event `call.permissions_updated`.
This will keep the current user informed about any changes in permissions, whether they are granted or rejected by hosts or speakers.
It's worth noting that the current user in the app will already possess permission to speak, as the default permission configuration allows the call creator to transmit audio.
Expand Down

0 comments on commit 9e69202

Please sign in to comment.