Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Oct 1, 2023
1 parent 78b6a95 commit b81f817
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ subscribe(evt => {
})
```

In iOS, You may need to change the Audio Session so that it can be used with other audio playback, or to optimize the quality of the recording. So we have provided AudioSession utilities for you:

```js
import { AudioSessionIos } from 'whisper.rn'

await AudioSessionIos.setCategory(
AudioSessionIos.Category.PlayAndRecord, [
AudioSessionIos.CategoryOption.MixWithOthers,
],
)
await AudioSessionIos.setMode(AudioSessionIos.Mode.Default)
await AudioSessionIos.setActive(true)
// Then you can start the realtime transcribe
```

In Android, you may need to request the microphone permission by [`PermissionAndroid`](https://reactnative.dev/docs/permissionsandroid).

Please visit the [Documentation](docs/) for more details.
Expand Down
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const updateAudioSession = async (log: any) => {
AudioSessionIos.CategoryOption.AllowBluetooth,
],
)
await AudioSessionIos.setMode(AudioSessionIos.Mode.SpokenAudio)
await AudioSessionIos.setMode(AudioSessionIos.Mode.Default)
await AudioSessionIos.setActive(true)

const categoryResult = await AudioSessionIos.getCurrentCategory()
Expand Down

0 comments on commit b81f817

Please sign in to comment.