File tree Expand file tree Collapse file tree 2 files changed +46
-4
lines changed Expand file tree Collapse file tree 2 files changed +46
-4
lines changed Original file line number Diff line number Diff line change
1
+ # dependencies
2
+ node_modules
3
+
4
+ # settings
1
5
.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
5
19
6
- .npmignore
20
+ npm-debug.log *
21
+ yarn-debug.log *
22
+ yarn-error.log
Original file line number Diff line number Diff line change @@ -38,11 +38,37 @@ const getAudio = (blob: Blob, title: string | undefined) => {
38
38
return < AudioRecorder onRecordingComplete= {(blob , title ) => getAudio (blob, title)} / > ;
39
39
` ` `
40
40
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
+
41
66
| Props | Description | Default | Optional |
42
67
| :------------------------ | :-------------------------------------------------------------------------------------- | :-------- | :------- |
43
68
| **` onRecordingComplete` ** | A method that gets called when "Save recording" option is pressed | N/A | Yes |
44
69
| **` timeLimit` ** | A Parameter to set the time limit for the audio recorder - "in Seconds" | Unlimited | Yes |
45
70
| **` 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 |
46
72
47
73
---
48
74
You can’t perform that action at this time.
0 commit comments