Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
added react-native-file-access instructions
  • Loading branch information
Efstathios Ntonas committed Jun 11, 2024
1 parent 4ac5f89 commit 8166a0f
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,13 +332,16 @@ onStopPlay = async () => {

If you want to get actual uri from the record or play file to actually grab it and upload it to your bucket, just grab the resolved message when using `startPlay` or `startRecord` method like below.

To access the file with more reliability, please use [react-native-blob-util](https://www.npmjs.com/package/react-native-blob-util). For example, below.
To access the file with more reliability, please use [react-native-blob-util](https://www.npmjs.com/package/react-native-blob-util) or [react-native-file-access](https://github.com/alpha0010/react-native-file-access). See below for examples.

```javascript
`react-native-blob-util`
```ts
import ReactNativeBlobUtil from 'react-native-blob-util'
...
const dirs = ReactNativeBlobUtil.fs.dirs;
const path = Platform.select({
ios: 'hello.m4a',
android: `${this.dirs.CacheDir}/hello.mp3`,
android: `${dirs.CacheDir}/hello.mp3`,
});
const uri = await audioRecorderPlayer.startRecord(path);
Expand All @@ -358,6 +361,20 @@ const path = Platform.select({
const uri = await audioRecorderPlayer.startRecord(path);
```
`react-native-file-access`
```ts
import { Dirs } from "react-native-file-access";
...
const path = Platform.select({
ios: 'hello.m4a',
android: `${Dirs.CacheDir}/hello.mp3`,
});

const uri = await audioRecorderPlayer.startRecord(path);
```
## Try yourself
1. Goto `Example` folder by running `cd Example`.
Expand Down

0 comments on commit 8166a0f

Please sign in to comment.