stream-chat-react-native 6.0.1 → 6.0.2-beta.1
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/package.json +2 -2
- package/src/index.js +2 -0
- package/src/optionalDependencies/Audio.ts +33 -110
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native",
|
|
3
3
|
"description": "The official React Native SDK for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "6.0.1",
|
|
4
|
+
"version": "6.0.2-beta.1",
|
|
5
5
|
"homepage": "https://www.npmjs.com/package/stream-chat-react-native",
|
|
6
6
|
"author": {
|
|
7
7
|
"company": "Stream.io Inc",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"types": "types/index.d.ts",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"es6-symbol": "^3.1.3",
|
|
23
|
-
"stream-chat-react-native-core": "6.0.1"
|
|
23
|
+
"stream-chat-react-native-core": "6.0.2-beta.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@react-native-camera-roll/camera-roll": ">=7.8.0",
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getPhotos,
|
|
13
13
|
iOS14RefreshGallerySelection,
|
|
14
14
|
oniOS14GalleryLibrarySelectionChange,
|
|
15
|
+
overrideAudioRecordingConfiguration,
|
|
15
16
|
pickDocument,
|
|
16
17
|
pickImage,
|
|
17
18
|
saveFile,
|
|
@@ -32,6 +33,7 @@ registerNativeHandlers({
|
|
|
32
33
|
getPhotos,
|
|
33
34
|
iOS14RefreshGallerySelection,
|
|
34
35
|
oniOS14GalleryLibrarySelectionChange,
|
|
36
|
+
overrideAudioRecordingConfiguration,
|
|
35
37
|
pickDocument,
|
|
36
38
|
pickImage,
|
|
37
39
|
saveFile,
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { PermissionsAndroid, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AudioEncoderAndroidType,
|
|
5
|
+
RNCLIAudioRecordingConfiguration as AudioRecordingConfiguration,
|
|
6
|
+
AudioSourceAndroidType,
|
|
7
|
+
AVEncoderAudioQualityIOSType,
|
|
8
|
+
AVEncodingOption,
|
|
9
|
+
AVModeIOSOption,
|
|
10
|
+
OutputFormatAndroidType,
|
|
11
|
+
RNCLIRecordingOptions as RecordingOptions,
|
|
12
|
+
} from 'stream-chat-react-native-core';
|
|
13
|
+
|
|
2
14
|
let AudioRecorderPackage;
|
|
3
15
|
let audioRecorderPlayer;
|
|
4
16
|
|
|
@@ -18,105 +30,6 @@ try {
|
|
|
18
30
|
console.log('react-native-audio-recorder-player is not installed.');
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
export enum AudioSourceAndroidType {
|
|
22
|
-
DEFAULT = 0,
|
|
23
|
-
MIC,
|
|
24
|
-
VOICE_UPLINK,
|
|
25
|
-
VOICE_DOWNLINK,
|
|
26
|
-
VOICE_CALL,
|
|
27
|
-
CAMCORDER,
|
|
28
|
-
VOICE_RECOGNITION,
|
|
29
|
-
VOICE_COMMUNICATION,
|
|
30
|
-
REMOTE_SUBMIX,
|
|
31
|
-
UNPROCESSED,
|
|
32
|
-
RADIO_TUNER = 1998,
|
|
33
|
-
HOTWORD,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export enum OutputFormatAndroidType {
|
|
37
|
-
DEFAULT = 0,
|
|
38
|
-
THREE_GPP,
|
|
39
|
-
MPEG_4,
|
|
40
|
-
AMR_NB,
|
|
41
|
-
AMR_WB,
|
|
42
|
-
AAC_ADIF,
|
|
43
|
-
AAC_ADTS,
|
|
44
|
-
OUTPUT_FORMAT_RTP_AVP,
|
|
45
|
-
MPEG_2_TS,
|
|
46
|
-
WEBM,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export enum AudioEncoderAndroidType {
|
|
50
|
-
DEFAULT = 0,
|
|
51
|
-
AMR_NB,
|
|
52
|
-
AMR_WB,
|
|
53
|
-
AAC,
|
|
54
|
-
HE_AAC,
|
|
55
|
-
AAC_ELD,
|
|
56
|
-
VORBIS,
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export enum AVEncodingOption {
|
|
60
|
-
aac = 'aac',
|
|
61
|
-
alac = 'alac',
|
|
62
|
-
alaw = 'alaw',
|
|
63
|
-
amr = 'amr',
|
|
64
|
-
flac = 'flac',
|
|
65
|
-
ima4 = 'ima4',
|
|
66
|
-
lpcm = 'lpcm',
|
|
67
|
-
MAC3 = 'MAC3',
|
|
68
|
-
MAC6 = 'MAC6',
|
|
69
|
-
mp1 = 'mp1',
|
|
70
|
-
mp2 = 'mp2',
|
|
71
|
-
mp4 = 'mp4',
|
|
72
|
-
opus = 'opus',
|
|
73
|
-
ulaw = 'ulaw',
|
|
74
|
-
wav = 'wav',
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export enum AVModeIOSOption {
|
|
78
|
-
gamechat = 'gamechat',
|
|
79
|
-
measurement = 'measurement',
|
|
80
|
-
movieplayback = 'movieplayback',
|
|
81
|
-
spokenaudio = 'spokenaudio',
|
|
82
|
-
videochat = 'videochat',
|
|
83
|
-
videorecording = 'videorecording',
|
|
84
|
-
voicechat = 'voicechat',
|
|
85
|
-
voiceprompt = 'voiceprompt',
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export type AVModeIOSType =
|
|
89
|
-
| AVModeIOSOption.gamechat
|
|
90
|
-
| AVModeIOSOption.measurement
|
|
91
|
-
| AVModeIOSOption.movieplayback
|
|
92
|
-
| AVModeIOSOption.spokenaudio
|
|
93
|
-
| AVModeIOSOption.videochat
|
|
94
|
-
| AVModeIOSOption.videorecording
|
|
95
|
-
| AVModeIOSOption.voicechat
|
|
96
|
-
| AVModeIOSOption.voiceprompt;
|
|
97
|
-
|
|
98
|
-
export enum AVEncoderAudioQualityIOSType {
|
|
99
|
-
min = 0,
|
|
100
|
-
low = 32,
|
|
101
|
-
medium = 64,
|
|
102
|
-
high = 96,
|
|
103
|
-
max = 127,
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export enum AVLinearPCMBitDepthKeyIOSType {
|
|
107
|
-
'bit8' = 8,
|
|
108
|
-
'bit16' = 16,
|
|
109
|
-
'bit24' = 24,
|
|
110
|
-
'bit32' = 32,
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export type RecordingOptions = {
|
|
114
|
-
/**
|
|
115
|
-
* A boolean that determines whether audio level information will be part of the status object under the "metering" key.
|
|
116
|
-
*/
|
|
117
|
-
isMeteringEnabled?: boolean;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
33
|
const verifyAndroidPermissions = async () => {
|
|
121
34
|
const isRN71orAbove = Platform.constants.reactNativeVersion?.minor >= 71;
|
|
122
35
|
const isAndroid13orAbove = (Platform.Version as number) >= 33;
|
|
@@ -175,6 +88,20 @@ const verifyAndroidPermissions = async () => {
|
|
|
175
88
|
};
|
|
176
89
|
|
|
177
90
|
class _Audio {
|
|
91
|
+
audioRecordingConfiguration: AudioRecordingConfiguration = {
|
|
92
|
+
options: {
|
|
93
|
+
audioSet: {
|
|
94
|
+
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
|
|
95
|
+
AudioSourceAndroid: AudioSourceAndroidType.MIC,
|
|
96
|
+
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
|
|
97
|
+
AVFormatIDKeyIOS: AVEncodingOption.aac,
|
|
98
|
+
AVModeIOS: AVModeIOSOption.spokenaudio,
|
|
99
|
+
AVNumberOfChannelsKeyIOS: 2,
|
|
100
|
+
OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS,
|
|
101
|
+
},
|
|
102
|
+
isMeteringEnabled: true,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
178
105
|
pausePlayer = async () => {
|
|
179
106
|
await audioRecorderPlayer.pausePlayer();
|
|
180
107
|
};
|
|
@@ -206,19 +133,11 @@ class _Audio {
|
|
|
206
133
|
android: `${RNBlobUtil.fs.dirs.CacheDir}/sound.aac`,
|
|
207
134
|
ios: 'sound.aac',
|
|
208
135
|
});
|
|
209
|
-
|
|
210
|
-
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
|
|
211
|
-
AudioSourceAndroid: AudioSourceAndroidType.MIC,
|
|
212
|
-
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
|
|
213
|
-
AVFormatIDKeyIOS: AVEncodingOption.aac,
|
|
214
|
-
AVModeIOS: AVModeIOSOption.measurement,
|
|
215
|
-
AVNumberOfChannelsKeyIOS: 2,
|
|
216
|
-
OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS,
|
|
217
|
-
};
|
|
136
|
+
console.log('ISE: AUDIO: ', this.audioRecordingConfiguration);
|
|
218
137
|
const recording = await audioRecorderPlayer.startRecorder(
|
|
219
138
|
path,
|
|
220
|
-
audioSet,
|
|
221
|
-
options
|
|
139
|
+
this.audioRecordingConfiguration.options.audioSet,
|
|
140
|
+
this.audioRecordingConfiguration.options.isMeteringEnabled,
|
|
222
141
|
);
|
|
223
142
|
|
|
224
143
|
audioRecorderPlayer.addRecordBackListener((status) => {
|
|
@@ -255,4 +174,8 @@ class _Audio {
|
|
|
255
174
|
};
|
|
256
175
|
}
|
|
257
176
|
|
|
177
|
+
export const overrideAudioRecordingConfiguration = (
|
|
178
|
+
audioRecordingConfiguration: AudioRecordingConfiguration,
|
|
179
|
+
) => audioRecordingConfiguration;
|
|
180
|
+
|
|
258
181
|
export const Audio = AudioRecorderPackage && RNBlobUtil ? new _Audio() : null;
|