@react-native-ohos/react-native-audio-recorder-player 3.6.14-rc.1 → 3.7.0-rc.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.
Files changed (35) hide show
  1. package/LICENSE +20 -20
  2. package/README.OpenSource +10 -10
  3. package/README.md +14 -14
  4. package/RNAudioRecorderPlayer.podspec +21 -21
  5. package/harmony/audio_recorder_player/BuildProfile.ets +16 -16
  6. package/harmony/audio_recorder_player/LICENSE +21 -21
  7. package/harmony/audio_recorder_player/build-profile.json5 +28 -28
  8. package/harmony/audio_recorder_player/index.ets +25 -25
  9. package/harmony/audio_recorder_player/oh-package.json5 +20 -20
  10. package/harmony/audio_recorder_player/src/main/cpp/CMakeLists.txt +7 -7
  11. package/harmony/audio_recorder_player/src/main/cpp/RNAudioRecorderPlayerPackage.h +48 -48
  12. package/harmony/audio_recorder_player/src/main/cpp/RNAudioRecorderPlayerTurboModule.cpp +90 -90
  13. package/harmony/audio_recorder_player/src/main/cpp/RNAudioRecorderPlayerTurboModule.h +35 -35
  14. package/harmony/audio_recorder_player/src/main/ets/RNAudioRecorderPlayerPackage.ts +47 -47
  15. package/harmony/audio_recorder_player/src/main/ets/RNAudioRecorderPlayerTurboModule.ts +323 -315
  16. package/harmony/audio_recorder_player/src/main/ets/audioPlayer/AudioPlayer.ts +464 -464
  17. package/harmony/audio_recorder_player/src/main/ets/audioPlayer/types.ts +45 -45
  18. package/harmony/audio_recorder_player/src/main/ets/recorder/Recorder.ts +299 -299
  19. package/harmony/audio_recorder_player/src/main/ets/recorder/types.ts +61 -61
  20. package/harmony/audio_recorder_player/src/main/ets/utils/DateTimeUtils.ts +88 -88
  21. package/harmony/audio_recorder_player/src/main/ets/utils/Logger.ts +45 -45
  22. package/harmony/audio_recorder_player/src/main/ets/utils/SaveAudioAsset.ts +105 -105
  23. package/harmony/audio_recorder_player/src/main/module.json5 +9 -9
  24. package/harmony/audio_recorder_player/src/main/resources/base/element/string.json +8 -8
  25. package/harmony/audio_recorder_player/src/main/resources/base/media/ic_public_error.svg +9 -9
  26. package/harmony/audio_recorder_player/src/main/resources/en_US/element/string.json +8 -8
  27. package/harmony/audio_recorder_player/src/main/resources/zh_CN/element/string.json +8 -8
  28. package/harmony/audio_recorder_player/ts.ts +26 -26
  29. package/harmony/audio_recorder_player.har +0 -0
  30. package/index.ts +538 -538
  31. package/package.json +59 -59
  32. package/src/NativeAudioRecorderPlayerModule.ts +42 -42
  33. package/harmony/audio_recorder_player/oh-package-lock.json5 +0 -18
  34. package/harmony/audio_recorder_player/src/main/ets/index.d.ts +0 -209
  35. package/index.d.ts +0 -226
package/package.json CHANGED
@@ -1,59 +1,59 @@
1
- {
2
- "name": "@react-native-ohos/react-native-audio-recorder-player",
3
- "version": "3.6.14-rc.1",
4
- "description": "React Native Audio Recorder and Player.",
5
- "homepage": "https://github.com/dooboolab/react-native-audio-recorder-player",
6
- "main": "index.ts",
7
- "types": "index.d.ts",
8
- "postinstall": "dooboolab-welcome postinstall",
9
- "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1",
11
- "build": "tsc && flowgen index.d.ts -o index.js.flow",
12
- "lint": "eslint -c .eslintrc.js 'index.ts'"
13
- },
14
- "harmony": {
15
- "alias": "react-native-audio-recorder-player"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/react-native-oh-library/react-native-audio-recorder-player"
20
- },
21
- "keywords": [
22
- "react-native",
23
- "audio",
24
- "sound",
25
- "record",
26
- "recorder",
27
- "player",
28
- "harmony"
29
- ],
30
- "files": [
31
- "src",
32
- "harmony",
33
- "index.ts",
34
- "index.d.ts",
35
- "RNAudioRecorderPlayer.podspec"
36
- ],
37
- "author": "dooboolab",
38
- "license": "MIT",
39
- "peerDependencies": {
40
- "react": "*",
41
- "react-native": "*"
42
- },
43
- "dependencies": {
44
- "dooboolab-welcome": "^1.3.2",
45
- "react-native-audio-recorder-player":"^3.6.13"
46
- },
47
- "devDependencies": {
48
- "eslint": "^8.57.0",
49
- "eslint-config-expo": "^7.1.2",
50
- "eslint-config-prettier": "^9.1.0",
51
- "eslint-plugin-prettier": "^5.1.3",
52
- "flow-bin": "^0.196.3",
53
- "flowgen": "^1.21.0",
54
- "jest": "^29.3.1",
55
- "prettier": "^3.3.0",
56
- "react-native": "^0.74.2",
57
- "typescript": "^4.9.4"
58
- }
59
- }
1
+ {
2
+ "name": "@react-native-ohos/react-native-audio-recorder-player",
3
+ "version": "3.7.0-rc.2",
4
+ "description": "React Native Audio Recorder and Player.",
5
+ "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-audio-recorder-player",
6
+ "main": "index.ts",
7
+ "types": "index.d.ts",
8
+ "postinstall": "dooboolab-welcome postinstall",
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "build": "tsc && flowgen index.d.ts -o index.js.flow",
12
+ "lint": "eslint -c .eslintrc.js 'index.ts'"
13
+ },
14
+ "harmony": {
15
+ "alias": "react-native-audio-recorder-player"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://gitcode.com/openharmony-sig/rntpc_react-native-audio-recorder-player"
20
+ },
21
+ "keywords": [
22
+ "react-native",
23
+ "audio",
24
+ "sound",
25
+ "record",
26
+ "recorder",
27
+ "player",
28
+ "harmony"
29
+ ],
30
+ "files": [
31
+ "src",
32
+ "harmony",
33
+ "index.ts",
34
+ "index.d.ts",
35
+ "RNAudioRecorderPlayer.podspec"
36
+ ],
37
+ "author": "dooboolab",
38
+ "license": "MIT",
39
+ "peerDependencies": {
40
+ "react": "*",
41
+ "react-native": "*"
42
+ },
43
+ "dependencies": {
44
+ "dooboolab-welcome": "^1.3.2",
45
+ "react-native-audio-recorder-player":"^3.6.13"
46
+ },
47
+ "devDependencies": {
48
+ "eslint": "^8.57.0",
49
+ "eslint-config-expo": "^7.1.2",
50
+ "eslint-config-prettier": "^9.1.0",
51
+ "eslint-plugin-prettier": "^5.1.3",
52
+ "flow-bin": "^0.196.3",
53
+ "flowgen": "^1.21.0",
54
+ "jest": "^29.3.1",
55
+ "prettier": "^3.3.0",
56
+ "react-native": "^0.74.2",
57
+ "typescript": "^4.9.4"
58
+ }
59
+ }
@@ -1,43 +1,43 @@
1
- /*
2
- * Copyright (c) 2024-2025 Huawei Device Co., Ltd. All rights reserved
3
- * Use of this source code is governed by a MIT license that can be
4
- * found in the LICENSE file.
5
- */
6
-
7
- import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
8
- import { TurboModuleRegistry } from 'react-native';
9
- import type{RecordBackType,PlayBackType,AudioSet} from '../index.d'
10
-
11
-
12
- interface Spec extends TurboModule{
13
- addRecordBackListener:(
14
- callback: (recordingMeta: RecordBackType) => void,
15
- )=>void;
16
- removeRecordBackListener:()=>void;
17
- addPlayBackListener:(
18
- callback: (playbackMeta: PlayBackType) => void,
19
- )=>void;
20
- removePlayBackListener:()=>void;
21
- startRecorder:(
22
- uri?: string,
23
- audioSets?: AudioSet,
24
- meteringEnabled?: boolean,
25
- )=>Promise<string>;
26
-
27
- pauseRecorder:()=>Promise<string>;
28
- resumeRecorder:()=>Promise<string>;
29
- stopRecorder:()=>Promise<string>;
30
- resumePlayer:()=>Promise<string>;
31
- startPlayer:(
32
- uri?: string,
33
- httpHeaders?: Record<string, string>,
34
- )=>Promise<string>;
35
- stopPlayer:()=> Promise<string>;
36
- pausePlayer:()=> Promise<string>;
37
- seekToPlayer:(time: number)=> Promise<string>;
38
- setVolume:(volume: number)=> Promise<string>;
39
- setPlaybackSpeed:(playbackSpeed: number)=> Promise<string>;
40
- setSubscriptionDuration:(sec: number)=> Promise<string>;
41
- }
42
-
1
+ /*
2
+ * Copyright (c) 2024-2025 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
8
+ import { TurboModuleRegistry } from 'react-native';
9
+ import type{RecordBackType,PlayBackType,AudioSet} from '../index.d'
10
+
11
+
12
+ interface Spec extends TurboModule{
13
+ addRecordBackListener:(
14
+ callback: (recordingMeta: RecordBackType) => void,
15
+ )=>void;
16
+ removeRecordBackListener:()=>void;
17
+ addPlayBackListener:(
18
+ callback: (playbackMeta: PlayBackType) => void,
19
+ )=>void;
20
+ removePlayBackListener:()=>void;
21
+ startRecorder:(
22
+ uri?: string,
23
+ audioSets?: AudioSet,
24
+ meteringEnabled?: boolean,
25
+ )=>Promise<string>;
26
+
27
+ pauseRecorder:()=>Promise<string>;
28
+ resumeRecorder:()=>Promise<string>;
29
+ stopRecorder:()=>Promise<string>;
30
+ resumePlayer:()=>Promise<string>;
31
+ startPlayer:(
32
+ uri?: string,
33
+ httpHeaders?: Record<string, string>,
34
+ )=>Promise<string>;
35
+ stopPlayer:()=> Promise<string>;
36
+ pausePlayer:()=> Promise<string>;
37
+ seekToPlayer:(time: number)=> Promise<string>;
38
+ setVolume:(volume: number)=> Promise<string>;
39
+ setPlaybackSpeed:(playbackSpeed: number)=> Promise<string>;
40
+ setSubscriptionDuration:(sec: number)=> Promise<string>;
41
+ }
42
+
43
43
  export default TurboModuleRegistry.get<Spec>('RNAudioRecorderPlayerTurboModule')
@@ -1,18 +0,0 @@
1
- {
2
- "meta": {
3
- "stableOrder": true
4
- },
5
- "lockfileVersion": 3,
6
- "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
7
- "specifiers": {
8
- "@rnoh/react-native-openharmony@../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har": "@rnoh/react-native-openharmony@../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har"
9
- },
10
- "packages": {
11
- "@rnoh/react-native-openharmony@../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har": {
12
- "name": "@rnoh/react-native-openharmony",
13
- "version": "0.77.10",
14
- "resolved": "../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har",
15
- "registryType": "local"
16
- }
17
- }
18
- }
@@ -1,209 +0,0 @@
1
- /**
2
- * MIT License
3
- *
4
- * Copyright (C) 2023 Huawei Device Co., Ltd.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- export enum AudioSourceHarmonyType {
26
- DEFAULT = 0,
27
- MIC,
28
- VOICE_RECOGNITION,
29
- VOICE_COMMUNICATION = 7,
30
- VOICE_MESSAGE = 10,
31
- CAMCORDER = 12,
32
- }
33
-
34
- export enum AudioFormatHarmonyType {
35
- MPEG_4 = 'mp4',
36
- MPEG_4A = 'm4a',
37
- MP3 = 'mp3',
38
- WAV = 'wav'
39
- }
40
-
41
- export enum AudioMimeHarmonyType {
42
- VIDEO_H263 = 'video/h263', // 表示视频/h263类型。
43
- VIDEO_AVC = 'video/avc', // 表示视频/avc类型。
44
- VIDEO_MPEG2 = 'video/mpeg2', // 表示视频/mpeg2类型。
45
- VIDEO_MPEG4 = 'video/mp4v-es', // 表示视频/mpeg4类型。
46
- VIDEO_VP8 = 'video/x-vnd.on2.vp8', // 表示视频/vp8类型。
47
- VIDEO_HEVC = 'video/hevc', // 表示视频/H265类型。
48
- AUDIO_AAC = 'audio/mp4a-latm', // 表示音频/mp4a-latm类型。
49
-
50
- AUDIO_VORBIS = 'audio/vorbis', // 表示音频/vorbis类型。
51
- AUDIO_FLAC = 'audio/flac', // 表示音频/flac类型。
52
- AUDIO_MP3 = 'audio/mpeg', // 表示音频/mpeg类型。
53
- AUDIO_G711MU = 'audio/g711mu', // 表示音频/G711-mulaw类型。
54
- }
55
-
56
- export enum AudioSourceAndroidType {
57
- DEFAULT = 0,
58
- MIC,
59
- VOICE_UPLINK,
60
- VOICE_DOWNLINK,
61
- VOICE_CALL,
62
- CAMCORDER,
63
- VOICE_RECOGNITION,
64
- VOICE_COMMUNICATION,
65
- REMOTE_SUBMIX,
66
- UNPROCESSED,
67
- RADIO_TUNER = 1998,
68
- HOTWORD,
69
- }
70
-
71
- export enum OutputFormatAndroidType {
72
- DEFAULT = 0,
73
- THREE_GPP,
74
- MPEG_4,
75
- AMR_NB,
76
- AMR_WB,
77
- AAC_ADIF,
78
- AAC_ADTS,
79
- OUTPUT_FORMAT_RTP_AVP,
80
- MPEG_2_TS,
81
- WEBM,
82
- UNUSED,
83
- OGG,
84
- }
85
-
86
- export enum AudioEncoderAndroidType {
87
- DEFAULT = 0,
88
- AMR_NB,
89
- AMR_WB,
90
- AAC,
91
- HE_AAC,
92
- AAC_ELD,
93
- VORBIS,
94
- OPUS,
95
- }
96
-
97
- export enum AVEncodingOption {
98
- lpcm = 'lpcm',
99
- ima4 = 'ima4',
100
- aac = 'aac',
101
- MAC3 = 'MAC3',
102
- MAC6 = 'MAC6',
103
- ulaw = 'ulaw',
104
- alaw = 'alaw',
105
- mp1 = 'mp1',
106
- mp2 = 'mp2',
107
- mp4 = 'mp4',
108
- alac = 'alac',
109
- amr = 'amr',
110
- flac = 'flac',
111
- opus = 'opus',
112
- wav = 'wav',
113
- }
114
-
115
- type AVEncodingType =
116
- | AVEncodingOption.lpcm
117
- | AVEncodingOption.ima4
118
- | AVEncodingOption.aac
119
- | AVEncodingOption.MAC3
120
- | AVEncodingOption.MAC6
121
- | AVEncodingOption.ulaw
122
- | AVEncodingOption.alaw
123
- | AVEncodingOption.mp1
124
- | AVEncodingOption.mp2
125
- | AVEncodingOption.mp4
126
- | AVEncodingOption.alac
127
- | AVEncodingOption.amr
128
- | AVEncodingOption.flac
129
- | AVEncodingOption.opus
130
- | AVEncodingOption.wav;
131
-
132
- export enum AVModeIOSOption {
133
- gamechat = 'gamechat',
134
- measurement = 'measurement',
135
- movieplayback = 'movieplayback',
136
- spokenaudio = 'spokenaudio',
137
- videochat = 'videochat',
138
- videorecording = 'videorecording',
139
- voicechat = 'voicechat',
140
- voiceprompt = 'voiceprompt',
141
- }
142
-
143
- export type AVModeIOSType =
144
- | AVModeIOSOption.gamechat
145
- | AVModeIOSOption.measurement
146
- | AVModeIOSOption.movieplayback
147
- | AVModeIOSOption.spokenaudio
148
- | AVModeIOSOption.videochat
149
- | AVModeIOSOption.videorecording
150
- | AVModeIOSOption.voicechat
151
- | AVModeIOSOption.voiceprompt;
152
-
153
- export enum AVEncoderAudioQualityIOSType {
154
- min = 0,
155
- low = 32,
156
- medium = 64,
157
- high = 96,
158
- max = 127,
159
- }
160
-
161
- export enum AVLinearPCMBitDepthKeyIOSType {
162
- 'bit8' = 8,
163
- 'bit16' = 16,
164
- 'bit24' = 24,
165
- 'bit32' = 32,
166
- }
167
-
168
- export interface AudioSet {
169
- AVSampleRateKeyIOS?: number;
170
- AVFormatIDKeyIOS?: AVEncodingType;
171
- AVModeIOS?: AVModeIOSType;
172
- AVNumberOfChannelsKeyIOS?: number;
173
- AVEncoderAudioQualityKeyIOS?: AVEncoderAudioQualityIOSType;
174
- AudioSourceAndroid?: AudioSourceAndroidType;
175
- AVLinearPCMBitDepthKeyIOS?: AVLinearPCMBitDepthKeyIOSType;
176
- AVLinearPCMIsBigEndianKeyIOS?: boolean;
177
- AVLinearPCMIsFloatKeyIOS?: boolean;
178
- AVLinearPCMIsNonInterleavedIOS?: boolean;
179
- AVEncoderBitRateKeyIOS?: number;
180
- OutputFormatAndroid?: OutputFormatAndroidType;
181
- AudioEncoderAndroid?: AudioEncoderAndroidType;
182
- AudioEncodingBitRateAndroid?: number;
183
- AudioSamplingRateAndroid?: number;
184
- AudioChannelsAndroid?: number;
185
- AudioSourceHarmony?: AudioSourceHarmonyType;
186
- AudioMimeHarmony?: AudioMimeHarmonyType;
187
- AudioFileFormatHarmony?: AudioFormatHarmonyType;
188
- AudioEncodingBitRateHarmony?: number;
189
- AudioSamplingRateHarmony?: number;
190
- AudioChannelsHarmony?: number;
191
- }
192
-
193
- export type RecordBackType = {
194
- isRecording?: boolean;
195
- currentPosition: number;
196
- currentMetering?: number;
197
- };
198
-
199
- export type PlayBackType = {
200
- isMuted?: boolean;
201
- currentPosition: number;
202
- duration: number;
203
- isFinished: boolean;
204
- };
205
-
206
- export enum harmonyEventName {
207
- recordBack = 'rn-recordback',
208
- playBack = 'rn-playback'
209
- }
package/index.d.ts DELETED
@@ -1,226 +0,0 @@
1
- /**
2
- * MIT License
3
- *
4
- * Copyright (C) 2023 Huawei Device Co., Ltd.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- export enum AudioSourceHarmonyType {
26
- DEFAULT = 0,
27
- MIC,
28
- VOICE_RECOGNITION,
29
- VOICE_COMMUNICATION = 7,
30
- VOICE_MESSAGE = 10,
31
- CAMCORDER = 12,
32
- }
33
-
34
- export enum AudioFormatHarmonyType {
35
- MPEG_4 = 'mp4',
36
- MPEG_4A = 'm4a',
37
- MP3 = 'mp3',
38
- WAV = 'wav'
39
- }
40
-
41
- export enum AudioMimeHarmonyType {
42
- AUDIO_AAC = 'audio/mp4a-latm', // 表示音频/mp4a-latm类型。
43
-
44
- AUDIO_VORBIS = 'audio/vorbis', // 表示音频/vorbis类型。
45
- AUDIO_FLAC = 'audio/flac', // 表示音频/flac类型。
46
- AUDIO_MP3 = 'audio/mpeg', // 表示音频/mpeg类型。
47
- AUDIO_G711MU = 'audio/g711mu', // 表示音频/G711-mulaw类型。
48
- }
49
-
50
- export enum AudioSourceAndroidType {
51
- DEFAULT = 0,
52
- MIC,
53
- }
54
-
55
- export enum OutputFormatAndroidType {
56
- DEFAULT = 0,
57
- THREE_GPP,
58
- MPEG_4,
59
- AMR_NB,
60
- AMR_WB,
61
- AAC_ADIF,
62
- AAC_ADTS,
63
- OUTPUT_FORMAT_RTP_AVP,
64
- MPEG_2_TS,
65
- WEBM,
66
- UNUSED,
67
- OGG,
68
- }
69
-
70
- export enum AudioEncoderAndroidType {
71
- DEFAULT = 0,
72
- AMR_NB,
73
- AMR_WB,
74
- AAC,
75
- HE_AAC,
76
- AAC_ELD,
77
- VORBIS,
78
- OPUS,
79
- }
80
-
81
- export enum AVEncodingOption {
82
- lpcm = 'lpcm',
83
- ima4 = 'ima4',
84
- aac = 'aac',
85
- MAC3 = 'MAC3',
86
- MAC6 = 'MAC6',
87
- ulaw = 'ulaw',
88
- alaw = 'alaw',
89
- mp1 = 'mp1',
90
- mp2 = 'mp2',
91
- mp4 = 'mp4',
92
- alac = 'alac',
93
- amr = 'amr',
94
- flac = 'flac',
95
- opus = 'opus',
96
- wav = 'wav',
97
- }
98
-
99
- export type AVEncodingType =
100
- | AVEncodingOption.lpcm
101
- | AVEncodingOption.ima4
102
- | AVEncodingOption.aac
103
- | AVEncodingOption.MAC3
104
- | AVEncodingOption.MAC6
105
- | AVEncodingOption.ulaw
106
- | AVEncodingOption.alaw
107
- | AVEncodingOption.mp1
108
- | AVEncodingOption.mp2
109
- | AVEncodingOption.mp4
110
- | AVEncodingOption.alac
111
- | AVEncodingOption.amr
112
- | AVEncodingOption.flac
113
- | AVEncodingOption.opus
114
- | AVEncodingOption.wav;
115
-
116
- export enum AVModeIOSOption {
117
- gamechat = 'gamechat',
118
- measurement = 'measurement',
119
- movieplayback = 'movieplayback',
120
- spokenaudio = 'spokenaudio',
121
- videochat = 'videochat',
122
- videorecording = 'videorecording',
123
- voicechat = 'voicechat',
124
- voiceprompt = 'voiceprompt',
125
- }
126
-
127
- export type AVModeIOSType =
128
- | AVModeIOSOption.gamechat
129
- | AVModeIOSOption.measurement
130
- | AVModeIOSOption.movieplayback
131
- | AVModeIOSOption.spokenaudio
132
- | AVModeIOSOption.videochat
133
- | AVModeIOSOption.videorecording
134
- | AVModeIOSOption.voicechat
135
- | AVModeIOSOption.voiceprompt;
136
-
137
- export enum AVEncoderAudioQualityIOSType {
138
- min = 0,
139
- low = 32,
140
- medium = 64,
141
- high = 96,
142
- max = 127,
143
- }
144
-
145
- export enum AVLinearPCMBitDepthKeyIOSType {
146
- 'bit8' = 8,
147
- 'bit16' = 16,
148
- 'bit24' = 24,
149
- 'bit32' = 32,
150
- }
151
-
152
- export interface AudioSet {
153
- AVSampleRateKeyIOS?: number;
154
- AVFormatIDKeyIOS?: AVEncodingType;
155
- AVModeIOS?: AVModeIOSType;
156
- AVNumberOfChannelsKeyIOS?: number;
157
- AVEncoderAudioQualityKeyIOS?: AVEncoderAudioQualityIOSType;
158
- AVLinearPCMBitDepthKeyIOS?: AVLinearPCMBitDepthKeyIOSType;
159
- AVLinearPCMIsBigEndianKeyIOS?: boolean;
160
- AVLinearPCMIsFloatKeyIOS?: boolean;
161
- AVLinearPCMIsNonInterleavedIOS?: boolean;
162
- AVEncoderBitRateKeyIOS?: number;
163
- OutputFormatAndroid?: OutputFormatAndroidType;
164
- AudioEncoderAndroid?: AudioEncoderAndroidType;
165
- AudioEncodingBitRateAndroid?: number;
166
- AudioSamplingRateAndroid?: number;
167
- AudioChannelsAndroid?: number;
168
- AudioSourceAndroid?: AudioSourceAndroidType;
169
- AudioSourceHarmony?: AudioSourceHarmonyType;
170
- AudioMimeHarmony?: AudioMimeHarmonyType;
171
- AudioFileFormatHarmony?: AudioFormatHarmonyType;
172
- /**
173
- * 音频编码比特率,选择音频录制时必填。
174
-
175
- 支持范围:
176
-
177
- - AAC编码格式支持比特率范围[32000 - 500000]。
178
-
179
- - G711-mulaw编码格式支持比特率范围[64000 - 64000]。
180
-
181
- - MP3编码格式支持范围[8000, 16000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000]。
182
-
183
- 当使用MP3编码格式时,采样率和比特率的映射关系:
184
-
185
- - 采样率使用16K以下时,对应比特率范围为[8kbps - 64kbps]。
186
-
187
- - 采样率使用16K~32K时对应的比特率范围为[8kbps - 160kbps]。
188
-
189
- - 采样率使用32K以上时对应的比特率范围为[32kbps - 320kbps]。
190
- */
191
- AudioEncodingBitRateHarmony?: number;
192
- /**
193
- * 支持范围:
194
-
195
- - AAC编码支持采样率范围[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000]。
196
-
197
- - G711-mulaw编码支持采样率范围[8000 - 8000]。
198
-
199
- - MP3编码支持采样率范围[8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000]。
200
- */
201
- AudioSamplingRateHarmony?: number;
202
- /**
203
- * 音频采集声道数
204
-
205
- - AAC编码格式支持范围[1 - 8]。
206
-
207
- - G711-mulaw编码格式支持范围[1 - 1]。
208
-
209
- - MP3编码格式支持范围[1 - 2]
210
- */
211
- AudioChannelsHarmony?: number;
212
- }
213
-
214
- export type RecordBackType = {
215
- isRecording?: boolean;
216
- currentPosition: number;
217
- currentMetering?: number;
218
- };
219
-
220
- export type PlayBackType = {
221
- isMuted?: boolean;
222
- currentPosition: number;
223
- duration: number;
224
- isFinished: boolean;
225
- };
226
-