Skip to content

Commit 189f5fe

Browse files
committed
chore:update some files
1 parent 49f6eba commit 189f5fe

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

.gitignore

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
1+
# dependencies
2+
node_modules
3+
4+
# settings
15
.vscode
2-
dist/
3-
node_modules/
4-
package-lock.json
6+
.npmignore
7+
8+
# builds
9+
build
10+
dist
11+
12+
# misc
13+
.DS_Store
14+
.env
15+
.env.local
16+
.env.development.local
17+
.env.test.local
18+
.env.production.local
519

6-
.npmignore
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,37 @@ const getAudio = (blob: Blob, title: string | undefined) => {
3838
return <AudioRecorder onRecordingComplete={(blob, title) => getAudio(blob, title)} />;
3939
```
4040
41+
## Usage 2
42+
43+
```js
44+
export function App() {
45+
const [audioUrl, setAudioUrl] = useState<{ url: string; title: string }>();
46+
const addAudioElement = (blob: Blob, title?: string) => {
47+
const url = URL.createObjectURL(blob);
48+
setAudioUrl({
49+
url,
50+
title: title!,
51+
});
52+
};
53+
54+
return (
55+
<>
56+
<AudioRecorder
57+
timeLimit={5}
58+
onRecordingComplete={(blob, title) => addAudioElement(blob, title)}
59+
/>
60+
{audioUrl && <audio src={audioUrl.url} title={audioUrl.title} controls />}
61+
</>
62+
);
63+
}
64+
```
65+
4166
| Props | Description | Default | Optional |
4267
| :------------------------ | :-------------------------------------------------------------------------------------- | :-------- | :------- |
4368
| **`onRecordingComplete`** | A method that gets called when "Save recording" option is pressed | N/A | Yes |
4469
| **`timeLimit`** | A Parameter to set the time limit for the audio recorder - "in Seconds" | Unlimited | Yes |
4570
| **`customControls`** | This Parameter allows you to create your own custom controls with your preferred style. | N/A | Yes |
71+
| **`askForTitle`** | This Parameter ask for audio title to set it for audio name `[audioTitle.mp3]` | false | Yes |
4672
4773
---
4874

0 commit comments

Comments
 (0)