@react-native-ohos/react-native-audio-recorder-player 3.7.1-beta.1 → 3.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +20 -20
- package/README.OpenSource +10 -10
- package/README.md +899 -753
- package/harmony/audio_recorder_player/BuildProfile.ets +16 -16
- package/harmony/audio_recorder_player/LICENSE +21 -21
- package/harmony/audio_recorder_player/build-profile.json5 +28 -28
- package/harmony/audio_recorder_player/index.ets +27 -25
- package/harmony/audio_recorder_player/oh-package-lock.json5 +18 -0
- package/harmony/audio_recorder_player/oh-package.json5 +20 -20
- package/harmony/audio_recorder_player/src/main/cpp/CMakeLists.txt +7 -7
- package/harmony/audio_recorder_player/src/main/cpp/RNAudioRecorderPlayerPackage.h +48 -48
- package/harmony/audio_recorder_player/src/main/cpp/RNAudioRecorderPlayerTurboModule.cpp +90 -90
- package/harmony/audio_recorder_player/src/main/cpp/RNAudioRecorderPlayerTurboModule.h +35 -35
- package/harmony/audio_recorder_player/src/main/ets/{RNAudioRecorderPlayerPackage.ts → RNAudioRecorderPlayerPackage.ets} +48 -47
- package/harmony/audio_recorder_player/src/main/ets/RNAudioRecorderPlayerTurboModule.ts +330 -323
- package/harmony/audio_recorder_player/src/main/ets/audioPlayer/AudioPlayer.ts +469 -464
- package/harmony/audio_recorder_player/src/main/ets/audioPlayer/types.ts +45 -45
- package/harmony/audio_recorder_player/src/main/ets/index.ts +209 -209
- package/harmony/audio_recorder_player/src/main/ets/recorder/Recorder.ts +305 -299
- package/harmony/audio_recorder_player/src/main/ets/recorder/types.ts +61 -61
- package/harmony/audio_recorder_player/src/main/ets/utils/DateTimeUtils.ts +88 -88
- package/harmony/audio_recorder_player/src/main/ets/utils/Logger.ts +45 -45
- package/harmony/audio_recorder_player/src/main/ets/utils/SaveAudioAsset.ts +101 -105
- package/harmony/audio_recorder_player/src/main/module.json5 +9 -9
- package/harmony/audio_recorder_player/src/main/resources/base/element/string.json +8 -8
- package/harmony/audio_recorder_player/src/main/resources/base/media/ic_public_error.svg +9 -9
- package/harmony/audio_recorder_player/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/audio_recorder_player/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/audio_recorder_player/{ts.ts → ts.ets} +26 -26
- package/harmony/audio_recorder_player.har +0 -0
- package/index.ts +539 -539
- package/package.json +77 -60
- package/src/NativeAudioRecorderPlayerModule.ts +42 -42
package/README.md
CHANGED
|
@@ -1,753 +1,899 @@
|
|
|
1
|
-
>
|
|
2
|
-
|
|
3
|
-
<p align="center">
|
|
4
|
-
<h1 align="center"> <code>react-native-audio-recorder-player</code> </h1>
|
|
5
|
-
</p>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
this.audioRecorderPlayer
|
|
475
|
-
this.
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
{
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
>
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
>
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
1
|
+
> 文档模板:v0.4.2
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<h1 align="center"> <code>react-native-audio-recorder-player</code> </h1>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
本项目基于 [react-native-audio-recorder-player](https://github.com/hyochan/react-native-audio-recorder-player) 开发。
|
|
8
|
+
|
|
9
|
+
该第三方库的仓库已迁移至 Gitcode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-audio-recorder-player` 版本所属关系如下:
|
|
10
|
+
| 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 |
|
|
11
|
+
| ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- |
|
|
12
|
+
| @react-native-ohos/react-native-audio-recorder-player | [~ 3.7.0(开发中)](https://www.npmjs.com/package/@react-native-ohos/react-native-audio-recorder-player) | [Gitcode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-audio-recorder-player/releases) | 0.77.* /0.82.* /0.84.* | partially(0.82/0.84) | API12+ | 3.6.13 | [master](https://gitcode.com/CPF-RN/rntpc_react-native-audio-recorder-player/tree/master) |
|
|
13
|
+
| @react-native-ohos/react-native-audio-recorder-player | [~ 3.6.11](https://www.npmjs.com/package/@react-native-ohos/react-native-audio-recorder-player) | [Gitcode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-audio-recorder-player/releases) | 0.72.* | 是 | API12+ | 3.6.10 | [br_rnoh0.72](https://gitcode.com/CPF-RN/rntpc_react-native-audio-recorder-player/tree/br_rnoh0.72) |
|
|
14
|
+
| @react-native-oh-tpl/react-native-audio-recorder-player | [<= 3.6.10-0.0.2@deprecated](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-audio-recorder-player) | [Github Releases(deprecated)](https://github.com/react-native-oh-library/react-native-audio-recorder-player/releases) | 0.72.* | 否 | API12+ |3.6.10 | [sig](https://github.com/react-native-oh-library/react-native-audio-recorder-player/tree/sig) |
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 简介
|
|
18
|
+
|
|
19
|
+
react-native-audio-recorder-player组件用于 React Native。是一个录音与播放组件,支持音频录制、音频播放等功能。
|
|
20
|
+
|
|
21
|
+
## 下载安装
|
|
22
|
+
|
|
23
|
+
进入到工程目录并输入以下命令:
|
|
24
|
+
|
|
25
|
+
**npm**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @react-native-ohos/react-native-audio-recorder-player
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**yarn**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn add @react-native-ohos/react-native-audio-recorder-player
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Link
|
|
38
|
+
|
|
39
|
+
| | 是否支持autolink | RN框架版本 |
|
|
40
|
+
|--------------------------------------|-----------------|------------|
|
|
41
|
+
| ~3.7.0 | partially(0.82/0.84) | 0.77/0.82/0.84 |
|
|
42
|
+
|
|
43
|
+
使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:https://gitcode.com/CPF-RN/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md
|
|
44
|
+
|
|
45
|
+
如您使用的版本支持 Autolink,并且工程已接入 Autolink,可跳过ManualLink配置。
|
|
46
|
+
<details>
|
|
47
|
+
<summary>ManualLink: 此步骤为手动配置原生依赖项的指导</summary>
|
|
48
|
+
|
|
49
|
+
首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。
|
|
50
|
+
|
|
51
|
+
### 1. Overrides RN SDK
|
|
52
|
+
|
|
53
|
+
为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。
|
|
54
|
+
|
|
55
|
+
关于该字段的作用请阅读[官方说明](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-oh-package-json5-V5#zh-cn_topic_0000001792256137_overrides)
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"overrides": {
|
|
60
|
+
"@rnoh/react-native-openharmony": "^0.72.38" // ohpm 在线版本
|
|
61
|
+
// "@rnoh/react-native-openharmony" : "./react_native_openharmony.har" // 指向本地 har 包的路径
|
|
62
|
+
// "@rnoh/react-native-openharmony" : "./react_native_openharmony" // 指向源码路径
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. 引入原生端代码
|
|
68
|
+
|
|
69
|
+
目前有两种方法:
|
|
70
|
+
|
|
71
|
+
1. 通过 har 包引入;
|
|
72
|
+
2. 直接链接源码。
|
|
73
|
+
|
|
74
|
+
方法一:通过 har 包引入(推荐)
|
|
75
|
+
|
|
76
|
+
> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
|
|
77
|
+
|
|
78
|
+
打开 `entry/oh-package.json5`,添加以下依赖
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
"dependencies": {
|
|
82
|
+
"@react-native-ohos/react-native-audio-recorder-player": "file:../../node_modules/@react-native-ohos/react-native-audio-recorder-player/harmony/audio_recorder_player.har"
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
点击右上角的 `sync` 按钮
|
|
86
|
+
|
|
87
|
+
或者在命令行终端执行:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
cd entry
|
|
91
|
+
ohpm install
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
方法二:直接链接源码
|
|
95
|
+
|
|
96
|
+
> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md)
|
|
97
|
+
|
|
98
|
+
### 3. 配置 CMakeLists 和引入 RNAudioRecorderPlayerPackage
|
|
99
|
+
|
|
100
|
+
打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
|
|
101
|
+
|
|
102
|
+
```diff
|
|
103
|
+
project(rnapp)
|
|
104
|
+
cmake_minimum_required(VERSION 3.4.1)
|
|
105
|
+
set(CMAKE_SKIP_BUILD_RPATH TRUE)
|
|
106
|
+
set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
107
|
+
set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
|
|
108
|
+
+ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
|
|
109
|
+
set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
|
|
110
|
+
set(LOG_VERBOSITY_LEVEL 1)
|
|
111
|
+
set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
|
|
112
|
+
set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
|
|
113
|
+
set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
|
|
114
|
+
add_compile_definitions(WITH_HITRACE_SYSTRACE)
|
|
115
|
+
|
|
116
|
+
add_subdirectory("${RNOH_CPP_DIR}" ./rn)
|
|
117
|
+
|
|
118
|
+
# RNOH_BEGIN: manual_package_linking_1
|
|
119
|
+
+ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-audio-recorder-player/src/main/cpp" ./audio_recorder_player)
|
|
120
|
+
# RNOH_END: manual_package_linking_1
|
|
121
|
+
|
|
122
|
+
file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
|
|
123
|
+
|
|
124
|
+
add_library(rnoh_app SHARED
|
|
125
|
+
${GENERATED_CPP_FILES}
|
|
126
|
+
"./PackageProvider.cpp"
|
|
127
|
+
"${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
|
|
128
|
+
)
|
|
129
|
+
target_link_libraries(rnoh_app PUBLIC rnoh)
|
|
130
|
+
|
|
131
|
+
# RNOH_BEGIN: manual_package_linking_2
|
|
132
|
+
+ target_link_libraries(rnoh_app PUBLIC rnoh_audio_recorder_player)
|
|
133
|
+
# RNOH_END: manual_package_linking_2
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
|
|
137
|
+
|
|
138
|
+
```diff
|
|
139
|
+
#include "RNOH/PackageProvider.h"
|
|
140
|
+
#include "SamplePackage.h"
|
|
141
|
+
+ #include "RNAudioRecorderPlayerPackage.h"
|
|
142
|
+
|
|
143
|
+
using namespace rnoh;
|
|
144
|
+
|
|
145
|
+
std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
|
|
146
|
+
return {
|
|
147
|
+
std::make_shared<SamplePackage>(ctx),
|
|
148
|
+
+ std::make_shared<RNAudioRecorderPlayerPackage>(ctx)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 4. 在 ArkTs 侧引入 RNAudioRecorderPlayerPackage
|
|
154
|
+
|
|
155
|
+
打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
|
|
156
|
+
|
|
157
|
+
```diff
|
|
158
|
+
+ import {RNAudioRecorderPlayerPackage} from '@react-native-ohos/react-native-audio-recorder-player/ts';
|
|
159
|
+
|
|
160
|
+
export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
|
|
161
|
+
return [
|
|
162
|
+
+ new RNAudioRecorderPlayerPackage(ctx)
|
|
163
|
+
];
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
### 运行
|
|
170
|
+
|
|
171
|
+
点击右上角的 `sync` 按钮
|
|
172
|
+
|
|
173
|
+
或者在命令行终端执行:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
cd entry
|
|
177
|
+
ohpm install
|
|
178
|
+
```
|
|
179
|
+
然后编译、运行即可。
|
|
180
|
+
|
|
181
|
+
## 约束与限制
|
|
182
|
+
|
|
183
|
+
### 兼容性
|
|
184
|
+
|
|
185
|
+
本文档内容基于以下版本验证通过:
|
|
186
|
+
|
|
187
|
+
1. RNOH: 0.77.18; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112;
|
|
188
|
+
2. RNOH: 0.82.30; SDK: HarmonyOS 6.0.2 Release SDK; IDE: DevEco Studio 6.0.2.650; ROM: 7.0.0;
|
|
189
|
+
3. RNOH: 0.84.1; SDK: HarmonyOS SDK 26.0.0 Beta2; IDE: DevEco Studio 26.0.0.621; ROM: 7.0.0;
|
|
190
|
+
|
|
191
|
+
### 权限要求
|
|
192
|
+
|
|
193
|
+
#### 在 entry 目录下的module.json5中添加权限
|
|
194
|
+
|
|
195
|
+
在`entry/src/main/module.json5`,添加:
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
"requestPermissions": [
|
|
199
|
+
{"name": "ohos.permission.INTERNET"},//网络播放音频需添加
|
|
200
|
+
{
|
|
201
|
+
"name": "ohos.permission.MICROPHONE",
|
|
202
|
+
"reason": "$string:Access_Create_Audio",
|
|
203
|
+
"usedScene": {
|
|
204
|
+
"abilities": [
|
|
205
|
+
"EntryAbility"
|
|
206
|
+
],
|
|
207
|
+
"when": "always"
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
]
|
|
211
|
+
```
|
|
212
|
+
#### 在 entry 目录下添加申请权限的原因
|
|
213
|
+
|
|
214
|
+
打开 `entry/src/main/resources/base/element/string.json`,添加:
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"string": [
|
|
219
|
+
{
|
|
220
|
+
"name": "Access_Create_Audio",
|
|
221
|
+
"value": "access create Audio"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 使用示例
|
|
228
|
+
|
|
229
|
+
下面的代码展示了这个库的基本使用场景:
|
|
230
|
+
|
|
231
|
+
> [!WARNING] 使用时 import 的库名不变。
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
import AudioRecorderPlayer, {
|
|
235
|
+
AVEncoderAudioQualityIOSType,
|
|
236
|
+
AVEncodingOption,
|
|
237
|
+
AudioEncoderAndroidType,
|
|
238
|
+
AudioSourceAndroidType,
|
|
239
|
+
OutputFormatAndroidType,
|
|
240
|
+
AudioMimeHarmonyType,
|
|
241
|
+
AudioFormatHarmonyType,
|
|
242
|
+
AudioSourceHarmonyType,
|
|
243
|
+
AudioSet
|
|
244
|
+
} from 'react-native-audio-recorder-player'; import type {
|
|
245
|
+
PlayBackType,
|
|
246
|
+
RecordBackType,
|
|
247
|
+
} from 'react-native-audio-recorder-player';
|
|
248
|
+
|
|
249
|
+
import {
|
|
250
|
+
Dimensions,
|
|
251
|
+
Platform,
|
|
252
|
+
ActivityIndicator,
|
|
253
|
+
Image,
|
|
254
|
+
SafeAreaView,
|
|
255
|
+
StyleSheet,
|
|
256
|
+
Text,
|
|
257
|
+
TouchableOpacity,
|
|
258
|
+
View,
|
|
259
|
+
} from 'react-native';
|
|
260
|
+
import React, { Component } from 'react';
|
|
261
|
+
|
|
262
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
263
|
+
|
|
264
|
+
const stylesButton: any = StyleSheet.create({
|
|
265
|
+
btn: {
|
|
266
|
+
backgroundColor: 'transparent',
|
|
267
|
+
alignSelf: 'center',
|
|
268
|
+
borderRadius: 4,
|
|
269
|
+
borderWidth: 2,
|
|
270
|
+
width: 320,
|
|
271
|
+
height: 52,
|
|
272
|
+
borderColor: 'white',
|
|
273
|
+
|
|
274
|
+
alignItems: 'center',
|
|
275
|
+
justifyContent: 'center',
|
|
276
|
+
},
|
|
277
|
+
btnDisabled: {
|
|
278
|
+
backgroundColor: 'rgb(243,243,243)',
|
|
279
|
+
alignSelf: 'center',
|
|
280
|
+
borderRadius: 4,
|
|
281
|
+
borderWidth: 2,
|
|
282
|
+
width: 320,
|
|
283
|
+
height: 52,
|
|
284
|
+
borderColor: '#333',
|
|
285
|
+
|
|
286
|
+
alignItems: 'center',
|
|
287
|
+
justifyContent: 'center',
|
|
288
|
+
},
|
|
289
|
+
txt: {
|
|
290
|
+
fontSize: 14,
|
|
291
|
+
color: 'white',
|
|
292
|
+
},
|
|
293
|
+
imgLeft: {
|
|
294
|
+
width: 24,
|
|
295
|
+
height: 24,
|
|
296
|
+
position: 'absolute',
|
|
297
|
+
left: 16,
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
interface ItemProps {
|
|
302
|
+
children?: ReactNode;
|
|
303
|
+
isLoading?: boolean;
|
|
304
|
+
isDisabled?: boolean;
|
|
305
|
+
onPress?: () => void;
|
|
306
|
+
style?: any;
|
|
307
|
+
disabledStyle?: any;
|
|
308
|
+
textStyle?: any;
|
|
309
|
+
imgLeftSrc?: any;
|
|
310
|
+
imgLeftStyle?: any;
|
|
311
|
+
indicatorColor?: string;
|
|
312
|
+
activeOpacity?: number;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
class Button extends Component<ItemProps, any> {
|
|
316
|
+
private static defaultProps: Partial<ItemProps> = {
|
|
317
|
+
isLoading: false,
|
|
318
|
+
isDisabled: false,
|
|
319
|
+
style: stylesButton.btn,
|
|
320
|
+
textStyle: stylesButton.txt,
|
|
321
|
+
imgLeftStyle: stylesButton.imgLeft,
|
|
322
|
+
indicatorColor: 'white',
|
|
323
|
+
activeOpacity: 0.5,
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
constructor(props: ItemProps) {
|
|
327
|
+
super(props);
|
|
328
|
+
this.state = {};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
public render(): ReactElement {
|
|
332
|
+
if (this.props.isDisabled) {
|
|
333
|
+
return (
|
|
334
|
+
<View style={this.props.disabledStyle}>
|
|
335
|
+
<Text style={this.props.textStyle}>{this.props.children}</Text>
|
|
336
|
+
</View>
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (this.props.isLoading) {
|
|
341
|
+
return (
|
|
342
|
+
<View style={this.props.style}>
|
|
343
|
+
<ActivityIndicator size="small" color={this.props.indicatorColor} />
|
|
344
|
+
</View>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return (
|
|
349
|
+
<TouchableOpacity
|
|
350
|
+
activeOpacity={this.props.activeOpacity}
|
|
351
|
+
onPress={this.props.onPress}>
|
|
352
|
+
<View style={this.props.style}>
|
|
353
|
+
{this.props.imgLeftSrc ? (
|
|
354
|
+
<Image
|
|
355
|
+
style={this.props.imgLeftStyle}
|
|
356
|
+
source={this.props.imgLeftSrc}
|
|
357
|
+
/>
|
|
358
|
+
) : null}
|
|
359
|
+
<Text style={this.props.textStyle}>{this.props.children}</Text>
|
|
360
|
+
</View>
|
|
361
|
+
</TouchableOpacity>
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const styles: any = StyleSheet.create({
|
|
367
|
+
container: {
|
|
368
|
+
flex: 1,
|
|
369
|
+
backgroundColor: '#455A64',
|
|
370
|
+
flexDirection: 'column',
|
|
371
|
+
alignItems: 'center',
|
|
372
|
+
height: Dimensions.get('screen').height
|
|
373
|
+
},
|
|
374
|
+
titleTxt: {
|
|
375
|
+
marginTop: 100,
|
|
376
|
+
color: 'white',
|
|
377
|
+
fontSize: 28,
|
|
378
|
+
},
|
|
379
|
+
viewRecorder: {
|
|
380
|
+
marginTop: 40,
|
|
381
|
+
width: '100%',
|
|
382
|
+
alignItems: 'center',
|
|
383
|
+
},
|
|
384
|
+
recordBtnWrapper: {
|
|
385
|
+
flexDirection: 'row',
|
|
386
|
+
},
|
|
387
|
+
viewPlayer: {
|
|
388
|
+
marginTop: 60,
|
|
389
|
+
alignSelf: 'stretch',
|
|
390
|
+
alignItems: 'center',
|
|
391
|
+
},
|
|
392
|
+
viewBarWrapper: {
|
|
393
|
+
marginTop: 28,
|
|
394
|
+
marginHorizontal: 28,
|
|
395
|
+
alignSelf: 'stretch',
|
|
396
|
+
},
|
|
397
|
+
viewBar: {
|
|
398
|
+
backgroundColor: '#ccc',
|
|
399
|
+
height: 4,
|
|
400
|
+
alignSelf: 'stretch',
|
|
401
|
+
},
|
|
402
|
+
viewBarPlay: {
|
|
403
|
+
backgroundColor: 'white',
|
|
404
|
+
height: 4,
|
|
405
|
+
width: 0,
|
|
406
|
+
},
|
|
407
|
+
playStatusTxt: {
|
|
408
|
+
marginTop: 8,
|
|
409
|
+
color: '#ccc',
|
|
410
|
+
},
|
|
411
|
+
playBtnWrapper: {
|
|
412
|
+
flexDirection: 'row',
|
|
413
|
+
marginTop: 40,
|
|
414
|
+
},
|
|
415
|
+
btn: {
|
|
416
|
+
borderColor: 'white',
|
|
417
|
+
borderWidth: 1,
|
|
418
|
+
},
|
|
419
|
+
txt: {
|
|
420
|
+
color: 'white',
|
|
421
|
+
fontSize: 14,
|
|
422
|
+
marginHorizontal: 8,
|
|
423
|
+
marginVertical: 4,
|
|
424
|
+
},
|
|
425
|
+
txtRecordCounter: {
|
|
426
|
+
marginTop: 32,
|
|
427
|
+
color: 'white',
|
|
428
|
+
fontSize: 20,
|
|
429
|
+
textAlignVertical: 'center',
|
|
430
|
+
fontWeight: '200',
|
|
431
|
+
fontFamily: 'Helvetica Neue',
|
|
432
|
+
letterSpacing: 3,
|
|
433
|
+
width: 300
|
|
434
|
+
},
|
|
435
|
+
txtCounter: {
|
|
436
|
+
marginTop: 12,
|
|
437
|
+
color: 'white',
|
|
438
|
+
fontSize: 20,
|
|
439
|
+
textAlignVertical: 'center',
|
|
440
|
+
fontWeight: '200',
|
|
441
|
+
fontFamily: 'Helvetica Neue',
|
|
442
|
+
letterSpacing: 3,
|
|
443
|
+
width: 300
|
|
444
|
+
},
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
interface State {
|
|
448
|
+
isLoggingIn: boolean;
|
|
449
|
+
recordSecs: number;
|
|
450
|
+
recordTime: string;
|
|
451
|
+
currentPositionSec: number;
|
|
452
|
+
currentDurationSec: number;
|
|
453
|
+
playTime: string;
|
|
454
|
+
duration: string;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
const screenWidth = Dimensions.get('screen').width;
|
|
458
|
+
|
|
459
|
+
class Page extends Component<any, State> {
|
|
460
|
+
private audioRecorderPlayer
|
|
461
|
+
|
|
462
|
+
constructor(props: any) {
|
|
463
|
+
super(props);
|
|
464
|
+
this.state = {
|
|
465
|
+
isLoggingIn: false,
|
|
466
|
+
recordSecs: 0,
|
|
467
|
+
recordTime: '00:00:00',
|
|
468
|
+
currentPositionSec: 0,
|
|
469
|
+
currentDurationSec: 0,
|
|
470
|
+
playTime: '00:00:00',
|
|
471
|
+
duration: '00:00:00',
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
this.audioRecorderPlayer = new AudioRecorderPlayer()
|
|
475
|
+
this.audioRecorderPlayer.setSubscriptionDuration(0.5); // optional. Default is 0.5
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
public render(): ReactElement {
|
|
479
|
+
let playWidth =
|
|
480
|
+
(this.state.currentPositionSec / this.state.currentDurationSec) *
|
|
481
|
+
(screenWidth - 56);
|
|
482
|
+
|
|
483
|
+
if (!playWidth) {
|
|
484
|
+
playWidth = 0;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return (
|
|
488
|
+
<SafeAreaView style={styles.container}>
|
|
489
|
+
<Text style={styles.titleTxt}>Audio Recorder Player</Text>
|
|
490
|
+
<Text style={styles.txtRecordCounter}>{this.state.recordTime}</Text>
|
|
491
|
+
<View style={styles.viewRecorder}>
|
|
492
|
+
<View style={styles.recordBtnWrapper}>
|
|
493
|
+
<Button
|
|
494
|
+
style={styles.btn}
|
|
495
|
+
onPress={this.onStartRecord}
|
|
496
|
+
textStyle={styles.txt}>
|
|
497
|
+
startRecord
|
|
498
|
+
</Button>
|
|
499
|
+
<Button
|
|
500
|
+
style={[
|
|
501
|
+
styles.btn,
|
|
502
|
+
{
|
|
503
|
+
marginLeft: 12,
|
|
504
|
+
},
|
|
505
|
+
]}
|
|
506
|
+
onPress={this.onPauseRecord}
|
|
507
|
+
textStyle={styles.txt}>
|
|
508
|
+
Pause
|
|
509
|
+
</Button>
|
|
510
|
+
<Button
|
|
511
|
+
style={[
|
|
512
|
+
styles.btn,
|
|
513
|
+
{
|
|
514
|
+
marginLeft: 12,
|
|
515
|
+
},
|
|
516
|
+
]}
|
|
517
|
+
onPress={this.onResumeRecord}
|
|
518
|
+
textStyle={styles.txt}>
|
|
519
|
+
Resume
|
|
520
|
+
</Button>
|
|
521
|
+
<Button
|
|
522
|
+
style={[styles.btn, { marginLeft: 12 }]}
|
|
523
|
+
onPress={this.onStopRecord}
|
|
524
|
+
textStyle={styles.txt}>
|
|
525
|
+
Stop
|
|
526
|
+
</Button>
|
|
527
|
+
</View>
|
|
528
|
+
</View>
|
|
529
|
+
<View style={styles.viewPlayer}>
|
|
530
|
+
<TouchableOpacity
|
|
531
|
+
style={styles.viewBarWrapper}
|
|
532
|
+
onPress={this.onStatusPress}>
|
|
533
|
+
<View style={styles.viewBar}>
|
|
534
|
+
<View style={[styles.viewBarPlay, { width: playWidth }]} />
|
|
535
|
+
</View>
|
|
536
|
+
</TouchableOpacity>
|
|
537
|
+
<Text style={styles.txtCounter}>
|
|
538
|
+
{this.state.playTime} / {this.state.duration}
|
|
539
|
+
</Text>
|
|
540
|
+
<View style={styles.playBtnWrapper}>
|
|
541
|
+
<Button
|
|
542
|
+
style={styles.btn}
|
|
543
|
+
onPress={this.onStartPlay}
|
|
544
|
+
textStyle={styles.txt}>
|
|
545
|
+
Play
|
|
546
|
+
</Button>
|
|
547
|
+
<Button
|
|
548
|
+
style={[
|
|
549
|
+
styles.btn,
|
|
550
|
+
{
|
|
551
|
+
marginLeft: 12,
|
|
552
|
+
},
|
|
553
|
+
]}
|
|
554
|
+
onPress={this.onPausePlay}
|
|
555
|
+
textStyle={styles.txt}>
|
|
556
|
+
Pause
|
|
557
|
+
</Button>
|
|
558
|
+
<Button
|
|
559
|
+
style={[
|
|
560
|
+
styles.btn,
|
|
561
|
+
{
|
|
562
|
+
marginLeft: 12,
|
|
563
|
+
},
|
|
564
|
+
]}
|
|
565
|
+
onPress={this.onResumePlay}
|
|
566
|
+
textStyle={styles.txt}>
|
|
567
|
+
Resume
|
|
568
|
+
</Button>
|
|
569
|
+
<Button
|
|
570
|
+
style={[
|
|
571
|
+
styles.btn,
|
|
572
|
+
{
|
|
573
|
+
marginLeft: 12,
|
|
574
|
+
},
|
|
575
|
+
]}
|
|
576
|
+
onPress={this.onStopPlay}
|
|
577
|
+
textStyle={styles.txt}>
|
|
578
|
+
Stop
|
|
579
|
+
</Button>
|
|
580
|
+
</View>
|
|
581
|
+
</View>
|
|
582
|
+
</SafeAreaView>
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
private onStatusPress = (e: any): void => {
|
|
587
|
+
const touchX = e.nativeEvent.locationX;
|
|
588
|
+
console.log(`touchX: ${touchX}`);
|
|
589
|
+
|
|
590
|
+
const playWidth =
|
|
591
|
+
(this.state.currentPositionSec / this.state.currentDurationSec) *
|
|
592
|
+
(screenWidth - 56);
|
|
593
|
+
console.log(`currentPlayWidth: ${playWidth}`);
|
|
594
|
+
|
|
595
|
+
const currentPosition = Math.round(this.state.currentPositionSec);
|
|
596
|
+
|
|
597
|
+
if (playWidth && playWidth < touchX) {
|
|
598
|
+
const addSecs = Math.round(currentPosition + 1000);
|
|
599
|
+
this.audioRecorderPlayer.seekToPlayer(addSecs);
|
|
600
|
+
console.log(`addSecs: ${addSecs}`);
|
|
601
|
+
} else {
|
|
602
|
+
const subSecs = Math.round(currentPosition - 1000);
|
|
603
|
+
this.audioRecorderPlayer.seekToPlayer(subSecs);
|
|
604
|
+
console.log(`subSecs: ${subSecs}`);
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
private onStartRecord = async (): Promise<void> => {
|
|
609
|
+
|
|
610
|
+
const audioSet: AudioSet = {
|
|
611
|
+
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
|
|
612
|
+
AudioSourceAndroid: AudioSourceAndroidType.MIC,
|
|
613
|
+
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
|
|
614
|
+
AVNumberOfChannelsKeyIOS: 2,
|
|
615
|
+
AVFormatIDKeyIOS: AVEncodingOption.aac,
|
|
616
|
+
OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS,
|
|
617
|
+
AudioSourceHarmony: AudioSourceHarmonyType.MIC,
|
|
618
|
+
AudioMimeHarmony: AudioMimeHarmonyType.AUDIO_AAC,
|
|
619
|
+
AudioFileFormatHarmony: AudioFormatHarmonyType.MPEG_4A,
|
|
620
|
+
AudioEncodingBitRateHarmony: 128000,
|
|
621
|
+
AudioSamplingRateHarmony: 44100,
|
|
622
|
+
AudioChannelsHarmony: 2,
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
console.log('audioSet', audioSet);
|
|
626
|
+
|
|
627
|
+
const uri = await this.audioRecorderPlayer.startRecorder(
|
|
628
|
+
'audio.m4a',
|
|
629
|
+
audioSet,
|
|
630
|
+
);
|
|
631
|
+
|
|
632
|
+
this.audioRecorderPlayer.addRecordBackListener((e: RecordBackType) => {
|
|
633
|
+
console.log('record-back', e);
|
|
634
|
+
this.setState({
|
|
635
|
+
recordSecs: e.currentPosition,
|
|
636
|
+
recordTime: this.audioRecorderPlayer.mmssss(
|
|
637
|
+
Math.floor(e.currentPosition),
|
|
638
|
+
),
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
console.log(`uri: ${uri}`);
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
private onPauseRecord = async (): Promise<void> => {
|
|
646
|
+
try {
|
|
647
|
+
const r = await this.audioRecorderPlayer.pauseRecorder();
|
|
648
|
+
console.log(r);
|
|
649
|
+
} catch (err) {
|
|
650
|
+
console.log('pauseRecord', err);
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
private onResumeRecord = async (): Promise<void> => {
|
|
655
|
+
await this.audioRecorderPlayer.resumeRecorder();
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
private onStopRecord = async (): Promise<void> => {
|
|
659
|
+
const result = await this.audioRecorderPlayer.stopRecorder();
|
|
660
|
+
this.audioRecorderPlayer.removeRecordBackListener();
|
|
661
|
+
this.setState({
|
|
662
|
+
recordSecs: 0,
|
|
663
|
+
});
|
|
664
|
+
console.log(result, '>>>>>>>stopRecorder');
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
private onStartPlay = async (): Promise<void> => {
|
|
668
|
+
console.log('onStartPlay');
|
|
669
|
+
|
|
670
|
+
try {
|
|
671
|
+
const msg = await this.audioRecorderPlayer.startPlayer('https://sis-sample-audio.obs.cn-north-1.myhuaweicloud.com/16k16bit.mp3', { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/21.0' });
|
|
672
|
+
const volume = await this.audioRecorderPlayer.setVolume(1);
|
|
673
|
+
this.audioRecorderPlayer.addPlayBackListener((e: PlayBackType) => {
|
|
674
|
+
console.log('playBackListener', e);
|
|
675
|
+
this.setState({
|
|
676
|
+
currentPositionSec: e.currentPosition,
|
|
677
|
+
currentDurationSec: e.duration,
|
|
678
|
+
playTime: this.audioRecorderPlayer.mmssss(e.currentPosition),
|
|
679
|
+
duration: this.audioRecorderPlayer.mmssss(Math.floor(e.duration)),
|
|
680
|
+
});
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
} catch (err) {
|
|
684
|
+
console.log('startPlayer error', err);
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
private onPausePlay = async (): Promise<void> => {
|
|
689
|
+
await this.audioRecorderPlayer.pausePlayer();
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
private onResumePlay = async (): Promise<void> => {
|
|
693
|
+
await this.audioRecorderPlayer.resumePlayer();
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
private onStopPlay = async (): Promise<void> => {
|
|
697
|
+
console.log('onStopPlay');
|
|
698
|
+
this.audioRecorderPlayer.stopPlayer();
|
|
699
|
+
this.audioRecorderPlayer.removePlayBackListener();
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
export default Page;
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
## 使用说明
|
|
707
|
+
|
|
708
|
+
**事件监听**
|
|
709
|
+
```javascript
|
|
710
|
+
this.audioRecorderPlayer = new AudioRecorderPlayer()
|
|
711
|
+
// 添加播放回调
|
|
712
|
+
this.audioRecorderPlayer.addPlayBackListener((e: PlayBackType) => {
|
|
713
|
+
// 播放中触发
|
|
714
|
+
});
|
|
715
|
+
// 移除播放回调
|
|
716
|
+
this.audioRecorderPlayer.removePlayBackListener();
|
|
717
|
+
// 添加录制回调
|
|
718
|
+
this.audioRecorderPlayer.addRecordBackListener((e: RecordBackType) => {
|
|
719
|
+
// 录制中触发
|
|
720
|
+
});
|
|
721
|
+
// 移除录制回调
|
|
722
|
+
this.audioRecorderPlayer.removeRecordBackListener();
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
**录制控制**
|
|
726
|
+
```javascript
|
|
727
|
+
this.audioRecorderPlayer = new AudioRecorderPlayer()
|
|
728
|
+
// 开始录制
|
|
729
|
+
this.audioRecorderPlayer.startRecorder(
|
|
730
|
+
'audio.m4a',
|
|
731
|
+
audioSet,
|
|
732
|
+
);
|
|
733
|
+
// 暂停录制
|
|
734
|
+
this.audioRecorderPlayer.pauseRecorder();
|
|
735
|
+
// 恢复录制
|
|
736
|
+
this.audioRecorderPlayer.resumeRecorder();
|
|
737
|
+
// 停止录制
|
|
738
|
+
this.audioRecorderPlayer.stopRecorder();
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
**播放控制**
|
|
742
|
+
```javascript
|
|
743
|
+
this.audioRecorderPlayer = new AudioRecorderPlayer()
|
|
744
|
+
// 设置订阅间隔时长
|
|
745
|
+
this.audioRecorderPlayer.setSubscriptionDuration(0.5);
|
|
746
|
+
// 定位到XX播放位置
|
|
747
|
+
this.audioRecorderPlayer.seekToPlayer(addSecs);
|
|
748
|
+
// 暂停播放
|
|
749
|
+
this.audioRecorderPlayer.pausePlayer();
|
|
750
|
+
// 恢复播放
|
|
751
|
+
this.audioRecorderPlayer.resumePlayer();
|
|
752
|
+
// 停止播放
|
|
753
|
+
this.audioRecorderPlayer.stopPlayer();
|
|
754
|
+
// 设置音量
|
|
755
|
+
this.audioRecorderPlayer.setVolume(1);
|
|
756
|
+
// 将毫秒转换为“分钟:秒:毫秒”格式的字符串
|
|
757
|
+
this.audioRecorderPlayer.mmssss(e.currentPosition),
|
|
758
|
+
// 将毫秒转换为“分:秒”格式的字符串
|
|
759
|
+
this.audioRecorderPlayer.mmss(
|
|
760
|
+
Math.floor(e.currentPosition),
|
|
761
|
+
),
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
## 接口说明
|
|
765
|
+
|
|
766
|
+
> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
|
|
767
|
+
|
|
768
|
+
> [!TIP] "HarmonyOS Support"列为 yes 表示 OpenHarmony 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
|
|
769
|
+
|
|
770
|
+
| Name | Description | Type | Required | Platform | HarmonyOS Support |
|
|
771
|
+
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------------- |
|
|
772
|
+
| `mmss` | 将秒转换为“分:秒”格式的字符串 | function(seconds:number): string | No | Android,iOS | yes |
|
|
773
|
+
| `mmssss` | 将毫秒转换为“分钟:秒:毫秒”格式的字符串 | function(milisecs:number): string | No | Android,iOS | yes |
|
|
774
|
+
| `setSubscriptionDuration` | 设置录音器或播放器启动时的默认回调时间间隔。默认为 0.5,即 500 毫秒。| function(sec:number):Promise<string> | No | Android,iOS | yes |
|
|
775
|
+
| `addRecordBackListener` |从原生模块获取回调。将接收 currentPosition、currentMetering(如果在 startRecorder 中进行了配置)。 | function(callBack:(value:RecordBackType)=>void): void | No | Android,iOS | yes |
|
|
776
|
+
| `removeRecordBackListener` |移除 recordBack 监听器。 | function(): void | No | Android,iOS | yes |
|
|
777
|
+
| `addPlayBackListener` | 从原生模块获取回调,将收到 duration 和 currentPosition。 | function(callBack:(value: PlayBackType)=>void): void | No | Android,iOS | yes |
|
|
778
|
+
| `removePlayBackListener` | 移除 playback 监听器。 | function(): void | No | Android,iOS | yes |
|
|
779
|
+
| `startRecorder` |开始录音。不传递 uri 参数时,音频将保存在默认位置。 | function(uri?:string,audioSets?: AudioSet,meteringEnabled?: boolean): Promise< string > | No | Android,iOS | yes |
|
|
780
|
+
| `pauseRecorder` | 暂停录音。 | function() : Promise< string > | No | Android,iOS | yes |
|
|
781
|
+
| `resumeRecorder` | 恢复录音。 | function() : Promise< string > | No | Android,iOS | yes |
|
|
782
|
+
| `stopRecorder` | 停止录音。 | function() : Promise< string > | No | Android,iOS | yes |
|
|
783
|
+
| `startPlayer` | 开始播放。不传递参数时,将播放默认位置的音频。 | function(uri?:string,httpHeaders?:Record<string,string>) : Promise< string > | No | Android,iOS | yes |
|
|
784
|
+
| `stopPlayer` | 停止播放。 | function() : Promise< string > | No | Android,iOS | yes |
|
|
785
|
+
| `pausePlayer` | 暂停播放。 | function() : Promise< string > | No | Android,iOS | yes |
|
|
786
|
+
| `resumePlayer` | 恢复播放。 | function() : Promise< string > | No | Android,iOS | yes |
|
|
787
|
+
| `seekToPlayer` | 音频跳转。 | function(time:number) : Promise< string > | No | Android,iOS | yes |
|
|
788
|
+
| `setVolume` | 设置音频播放器的音量(默认值为 1.0,取值范围:0.0 ~ 1.0)。 | function(volume:float) : Promise< string > | No | Android,iOS | yes |
|
|
789
|
+
| `setPlaybackSpeed` | 设置播放速度。<br/>鸿蒙化后仅支持0.125、0.25、0.5、0.75、1、1.25、1.5、1.75、2和3倍速设置,其中3倍速仅在API version 13开始支持。 | function(playbackSpeed: number): Promise< string > | No | Android,iOS | partially (3倍速仅在API version 13开始支持) |
|
|
790
|
+
|
|
791
|
+
## 鸿蒙平台 AudioSet 属性说明
|
|
792
|
+
|
|
793
|
+
在 `startRecorder` 方法中使用的 `AudioSet` 对象包含多个平台的配置属性,其中以 `Harmony` 后缀结尾的属性为鸿蒙平台专属配置。以下对鸿蒙平台相关的枚举类型和属性进行详细说明。
|
|
794
|
+
|
|
795
|
+
### AudioSourceHarmonyType(音频输入源类型)
|
|
796
|
+
|
|
797
|
+
用于设置录音时的音频输入源,通过 `AudioSet.AudioSourceHarmony` 属性配置。
|
|
798
|
+
|
|
799
|
+
| 枚举值 | 对应数值 | 说明 |
|
|
800
|
+
| --------------------- | -------- | ----------------------------------- |
|
|
801
|
+
| `DEFAULT` | 0 | 默认音频源 |
|
|
802
|
+
| `MIC` | 1 | 麦克风输入 |
|
|
803
|
+
| `VOICE_RECOGNITION` | 2 | 语音识别,适用于语音转文字等场景 |
|
|
804
|
+
| `VOICE_COMMUNICATION` | 7 | 语音通信,适用于 VoIP 等实时通话场景 |
|
|
805
|
+
| `VOICE_MESSAGE` | 10 | 语音消息,适用于录制语音短消息 |
|
|
806
|
+
| `CAMCORDER` | 12 | 摄像头录音,与视频同步录制音频 |
|
|
807
|
+
|
|
808
|
+
### AudioMimeHarmonyType(音频 MIME 类型)
|
|
809
|
+
|
|
810
|
+
用于设置录音的音频编码格式 MIME 类型,通过 `AudioSet.AudioMimeHarmony` 属性配置。
|
|
811
|
+
|
|
812
|
+
| 枚举值 | 对应值 | 说明 |
|
|
813
|
+
| --------------- | ----------------- | ----------------------------- |
|
|
814
|
+
| `AUDIO_AAC` | `audio/mp4a-latm` | AAC 编码格式(音频/mp4a-latm) |
|
|
815
|
+
| `AUDIO_VORBIS` | `audio/vorbis` | Vorbis 编码格式 |
|
|
816
|
+
| `AUDIO_FLAC` | `audio/flac` | FLAC 无损编码格式 |
|
|
817
|
+
| `AUDIO_MP3` | `audio/mpeg` | MP3 编码格式 |
|
|
818
|
+
| `AUDIO_G711MU` | `audio/g711mu` | G711-mulaw 编码格式 |
|
|
819
|
+
|
|
820
|
+
### AudioFormatHarmonyType(音频文件格式类型)
|
|
821
|
+
|
|
822
|
+
用于设置录音输出的音频文件格式(后缀名),通过 `AudioSet.AudioFileFormatHarmony` 属性配置。
|
|
823
|
+
|
|
824
|
+
| 枚举值 | 对应值 | 说明 |
|
|
825
|
+
| --------- | ------ | ----------------------------- |
|
|
826
|
+
| `MPEG_4` | `mp4` | MPEG-4 容器格式(.mp4 文件) |
|
|
827
|
+
| `MPEG_4A` | `m4a` | MPEG-4 音频格式(.m4a 文件) |
|
|
828
|
+
| `MP3` | `mp3` | MP3 格式(.mp3 文件) |
|
|
829
|
+
| `WAV` | `wav` | WAV 格式(.wav 文件) |
|
|
830
|
+
| `AAC` | `aac` | AAC 格式(.aac 文件) |
|
|
831
|
+
|
|
832
|
+
### AudioSet 鸿蒙专属属性说明
|
|
833
|
+
|
|
834
|
+
| 属性名 | 类型 | 说明 |
|
|
835
|
+
| ----------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
836
|
+
| `AudioSourceHarmony` | `AudioSourceHarmonyType` | 音频输入源类型。用于指定录音时的音频来源,默认为 `MIC`(麦克风)。 |
|
|
837
|
+
| `AudioMimeHarmony` | `AudioMimeHarmonyType` | 音频编码格式(MIME 类型)。用于指定录音的音频编码方式,如 AAC、MP3、FLAC 等。需与对应的采样率、比特率、声道数范围匹配。 |
|
|
838
|
+
| `AudioFileFormatHarmony` | `AudioFormatHarmonyType` | 音频文件输出格式。用于指定录音文件的容器格式及后缀名,如 `m4a`、`mp3`、`wav` 等。 |
|
|
839
|
+
| `AudioEncodingBitRateHarmony` | `number` | 音频编码比特率(单位:bps)。选择音频录制时必填。支持范围:<br>- AAC 编码格式支持比特率范围 `[32000 - 500000]`<br>- G711-mulaw 编码格式支持比特率范围 `[64000 - 64000]`<br>- MP3 编码格式支持 `[8000, 16000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000]` |
|
|
840
|
+
| `AudioSamplingRateHarmony` | `number` | 音频采样率(单位:Hz)。支持范围:<br>- AAC 编码支持采样率范围 `[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000]`<br>- G711-mulaw 编码支持采样率范围 `[8000 - 8000]`<br>- MP3 编码支持采样率范围 `[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000]` |
|
|
841
|
+
| `AudioChannelsHarmony` | `number` | 音频采集声道数。支持范围:<br>- AAC 编码格式支持范围 `[1 - 8]`<br>- G711-mulaw 编码格式支持范围 `[1 - 1]`<br>- MP3 编码格式支持范围 `[1 - 2]` |
|
|
842
|
+
|
|
843
|
+
> [!TIP] 在使用 MP3 编码格式时,采样率和比特率存在映射关系:采样率 16K 以下时对应比特率范围为 `[8kbps - 64kbps]`;采样率 16K~32K 时对应比特率范围为 `[8kbps - 160kbps]`;采样率 32K 以上时对应比特率范围为 `[32kbps - 320kbps]`。
|
|
844
|
+
|
|
845
|
+
### 使用示例
|
|
846
|
+
|
|
847
|
+
```javascript
|
|
848
|
+
import {
|
|
849
|
+
AudioMimeHarmonyType,
|
|
850
|
+
AudioFormatHarmonyType,
|
|
851
|
+
AudioSourceHarmonyType,
|
|
852
|
+
AudioSet
|
|
853
|
+
} from 'react-native-audio-recorder-player';
|
|
854
|
+
|
|
855
|
+
const audioSet: AudioSet = {
|
|
856
|
+
// 鸿蒙平台录音配置
|
|
857
|
+
AudioSourceHarmony: AudioSourceHarmonyType.MIC, // 使用麦克风作为音频输入源
|
|
858
|
+
AudioMimeHarmony: AudioMimeHarmonyType.AUDIO_AAC, // 使用 AAC 编码格式
|
|
859
|
+
AudioFileFormatHarmony: AudioFormatHarmonyType.MPEG_4A, // 输出为 m4a 格式文件
|
|
860
|
+
AudioEncodingBitRateHarmony: 128000, // 设置编码比特率为 128000 bps
|
|
861
|
+
AudioSamplingRateHarmony: 44100, // 设置采样率为 44100 Hz
|
|
862
|
+
AudioChannelsHarmony: 2, // 设置双声道录制
|
|
863
|
+
};
|
|
864
|
+
|
|
865
|
+
const uri = await this.audioRecorderPlayer.startRecorder('audio.m4a', audioSet);
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
## 遗留问题
|
|
869
|
+
无
|
|
870
|
+
|
|
871
|
+
## 其他
|
|
872
|
+
无
|
|
873
|
+
|
|
874
|
+
## 目录结构
|
|
875
|
+
````
|
|
876
|
+
/rntpc_react-native-audio-recorder-player # 项目根目录
|
|
877
|
+
├── harmony # 鸿蒙适配代码
|
|
878
|
+
│ ├─ audio_recorder_player.har # har包
|
|
879
|
+
│ └─ audio_recorder_player # 鸿蒙适配核心代码
|
|
880
|
+
│ └─ index.ets # 鸿蒙适配代码入口
|
|
881
|
+
│ └─ src/main/ets
|
|
882
|
+
│ ├─ audioPlayer
|
|
883
|
+
│ └─ AudioPlayer.ts # 音频播放文件
|
|
884
|
+
│ └─ recorder
|
|
885
|
+
│ └─ Recorder.ts # 音频录制文件
|
|
886
|
+
├── src # RN代码
|
|
887
|
+
│ └─ NativeAudioRecorderPlayerModule.ts # TurboModule文件
|
|
888
|
+
├── index.ts # 入口文件
|
|
889
|
+
├── README_en.md # 英文安装使用方法
|
|
890
|
+
├── README.md # 中文安装使用方法
|
|
891
|
+
````
|
|
892
|
+
|
|
893
|
+
## 贡献代码
|
|
894
|
+
|
|
895
|
+
使用过程中发现任何问题都可以提交 [Issue](https://gitcode.com/CPF-RN/rntpc_react-native-audio-recorder-player/issues),当然,也非常欢迎提交 [PR](https://gitcode.com/CPF-RN/rntpc_react-native-audio-recorder-player/pulls) 。
|
|
896
|
+
|
|
897
|
+
## 开源协议
|
|
898
|
+
|
|
899
|
+
本项目基于 [The MIT License (MIT)](https://github.com/hyochan/react-native-audio-recorder-player/blob/main/LICENSE) ,请自由地享受和参与开源。
|