forked from hyochan/react-native-audio-recorder-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js.flow
177 lines (160 loc) · 4.16 KB
/
index.js.flow
1
2
3
4
5
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
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
/**
* Flowtype definitions for index
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.10.0
*/
declare export var AudioSourceAndroidType: {|
+DEFAULT: 0, // 0
+MIC: 1, // 1
+VOICE_UPLINK: 2, // 2
+VOICE_DOWNLINK: 3, // 3
+VOICE_CALL: 4, // 4
+CAMCORDER: 5, // 5
+VOICE_RECOGNITION: 6, // 6
+VOICE_COMMUNICATION: 7, // 7
+REMOTE_SUBMIX: 8, // 8
+UNPROCESSED: 9, // 9
+RADIO_TUNER: 1998, // 1998
+HOTWORD: 1999 // 1999
|};
declare export var OutputFormatAndroidType: {|
+DEFAULT: 0, // 0
+THREE_GPP: 1, // 1
+MPEG_4: 2, // 2
+AMR_NB: 3, // 3
+AMR_WB: 4, // 4
+AAC_ADIF: 5, // 5
+AAC_ADTS: 6, // 6
+OUTPUT_FORMAT_RTP_AVP: 7, // 7
+MPEG_2_TS: 8, // 8
+WEBM: 9 // 9
|};
declare export var AudioEncoderAndroidType: {|
+DEFAULT: 0, // 0
+AMR_NB: 1, // 1
+AMR_WB: 2, // 2
+AAC: 3, // 3
+HE_AAC: 4, // 4
+AAC_ELD: 5, // 5
+VORBIS: 6 // 6
|};
declare type AVEncodingType =
| typeof AVEncodingOption.lpcm
| typeof AVEncodingOption.ima4
| typeof AVEncodingOption.aac
| typeof AVEncodingOption.MAC3
| typeof AVEncodingOption.MAC6
| typeof AVEncodingOption.ulaw
| typeof AVEncodingOption.alaw
| typeof AVEncodingOption.mp1
| typeof AVEncodingOption.mp2
| typeof AVEncodingOption.alac
| typeof AVEncodingOption.amr
| typeof AVEncodingOption.flac
| typeof AVEncodingOption.opus;
declare export var AVEncodingOption: {|
+lpcm: "lpcm", // "lpcm"
+ima4: "ima4", // "ima4"
+aac: "aac", // "aac"
+MAC3: "MAC3", // "MAC3"
+MAC6: "MAC6", // "MAC6"
+ulaw: "ulaw", // "ulaw"
+alaw: "alaw", // "alaw"
+mp1: "mp1", // "mp1"
+mp2: "mp2", // "mp2"
+alac: "alac", // "alac"
+amr: "amr", // "amr"
+flac: "flac", // "flac"
+opus: "opus" // "opus"
|};
declare export var AVEncoderAudioQualityIOSType: {|
+min: 0, // 0
+low: 32, // 32
+medium: 64, // 64
+high: 96, // 96
+max: 127 // 127
|};
export interface AudioSet {
AVSampleRateKeyIOS?: number;
AVFormatIDKeyIOS?: AVEncodingType;
AVNumberOfChannelsKeyIOS?: number;
AVEncoderAudioQualityKeyIOS?: $Values<typeof AVEncoderAudioQualityIOSType>;
AudioSourceAndroid?: $Values<typeof AudioSourceAndroidType>;
OutputFormatAndroid?: $Values<typeof OutputFormatAndroidType>;
AudioEncoderAndroid?: $Values<typeof AudioEncoderAndroidType>;
}
declare class AudioRecorderPlayer {
mmss: (secs: number) => string;
mmssss: (milisecs: number) => string;
/**
* set listerner from native module for recorder.
* @returns {callBack} (e: any)}
*/
addRecordBackListener: (e: any) => void;
/**
* remove listener for recorder.
* @returns {void}
*/
removeRecordBackListener: () => void;
/**
* set listener from native module for player.
* @returns {callBack} (e: Event)}
*/
addPlayBackListener: (e: any) => void;
/**
* remove listener for player.
* @returns {void}
*/
removePlayBackListener: () => void;
/**
* start recording with param.
* @param {string} uri audio uri.
* @returns {Promise<string>}
*/
startRecorder: (uri?: string, audioSets?: AudioSet) => Promise<string>;
/**
* stop recording.
* @returns {Promise<string>}
*/
stopRecorder: () => Promise<string>;
/**
* resume playing.
* @returns {Promise<string>}
*/
resumePlayer: () => Promise<string>;
/**
* start playing with param.
* @param {string} uri audio uri.
* @returns {Promise<string>}
*/
startPlayer: (uri: string) => Promise<string>;
/**
* stop playing.
* @returns {Promise<string>}
*/
stopPlayer: () => Promise<string>;
/**
* pause playing.
* @returns {Promise<string>}
*/
pausePlayer: () => Promise<string>;
/**
* seek to.
* @param {number} time position seek to in second.
* @returns {Promise<string>}
*/
seekToPlayer: (time: number) => Promise<string>;
/**
* set volume.
* @param {number} setVolume set volume.
* @returns {Promise<string>}
*/
setVolume: (volume: number) => Promise<string>;
/**
* set subscription duration.
* @param {number} sec subscription callback duration in seconds.
* @returns {Promise<string>}
*/
setSubscriptionDuration: (sec: number) => Promise<string>;
}
declare export default typeof AudioRecorderPlayer;