stream-chat-react-native 8.7.1-beta.2 → 8.8.0-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 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": "8.7.1-beta.2",
4
+ "version": "8.8.0-beta.1",
5
5
  "homepage": "https://www.npmjs.com/package/stream-chat-react-native",
6
6
  "author": {
7
7
  "company": "Stream.io Inc",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "es6-symbol": "^3.1.3",
23
23
  "mime": "^4.0.7",
24
- "stream-chat-react-native-core": "8.7.1-beta.2"
24
+ "stream-chat-react-native-core": "8.8.0-beta.1"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@react-native-camera-roll/camera-roll": ">=7.8.0",
@@ -30,6 +30,7 @@
30
30
  "@stream-io/flat-list-mvcp": ">=0.10.3",
31
31
  "react-native": ">=0.73.0",
32
32
  "react-native-audio-recorder-player": ">=3.6.13",
33
+ "react-native-nitro-sound": ">=0.2.9",
33
34
  "react-native-blob-util": ">=0.21.1",
34
35
  "react-native-haptic-feedback": ">=2.3.0",
35
36
  "react-native-image-picker": ">=7.1.2",
@@ -61,6 +62,9 @@
61
62
  "react-native-audio-recorder-player": {
62
63
  "optional": true
63
64
  },
65
+ "react-native-nitro-sound": {
66
+ "optional": true
67
+ },
64
68
  "react-native-video": {
65
69
  "optional": true
66
70
  },
@@ -7,11 +7,14 @@ import {
7
7
  AVEncoderAudioQualityIOSType,
8
8
  AVEncodingOption,
9
9
  AVModeIOSOption,
10
+ AVModeIOSOptionNitroSound,
10
11
  OutputFormatAndroidType,
11
12
  RNCLIRecordingOptions as RecordingOptions,
12
13
  } from 'stream-chat-react-native-core';
13
14
 
14
15
  let AudioRecorderPackage;
16
+ let AudioRecorderPackageAudioRecorderPlayer;
17
+ let AudioRecorderPackageNitroSound;
15
18
  let audioRecorderPlayer;
16
19
 
17
20
  let RNBlobUtil;
@@ -23,11 +26,26 @@ try {
23
26
  }
24
27
 
25
28
  try {
26
- AudioRecorderPackage = require('react-native-audio-recorder-player').default;
27
- audioRecorderPlayer = new AudioRecorderPackage();
28
- audioRecorderPlayer.setSubscriptionDuration(Platform.OS === 'android' ? 0.1 : 0.06);
29
+ AudioRecorderPackageNitroSound = require('react-native-nitro-sound');
30
+ } catch (e) {
31
+ console.log(
32
+ 'The package react-native-audio-recorder-player is deprecated. Please install react-native-nitro-sound instead.',
33
+ );
34
+ }
35
+
36
+ try {
37
+ AudioRecorderPackageAudioRecorderPlayer = require('react-native-audio-recorder-player').default;
29
38
  } catch (e) {
30
- console.log('react-native-audio-recorder-player is not installed.');
39
+ // do nothing
40
+ }
41
+
42
+ AudioRecorderPackage = AudioRecorderPackageNitroSound || AudioRecorderPackageAudioRecorderPlayer;
43
+ if (AudioRecorderPackageNitroSound) {
44
+ audioRecorderPlayer = AudioRecorderPackageNitroSound.createSound();
45
+ audioRecorderPlayer.setSubscriptionDuration(Platform.OS === 'android' ? 0.1 : 0.06);
46
+ } else if (AudioRecorderPackageAudioRecorderPlayer) {
47
+ audioRecorderPlayer = new AudioRecorderPackageAudioRecorderPlayer();
48
+ audioRecorderPlayer.setSubscriptionDuration(Platform.OS === 'android' ? 0.1 : 0.06);
31
49
  }
32
50
 
33
51
  const verifyAndroidPermissions = async () => {
@@ -91,13 +109,18 @@ class _Audio {
91
109
  audioRecordingConfiguration: AudioRecordingConfiguration = {
92
110
  options: {
93
111
  audioSet: {
112
+ // Android specific properties
94
113
  AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
95
114
  AudioSourceAndroid: AudioSourceAndroidType.MIC,
115
+ OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS,
116
+
117
+ // iOS specific properties
96
118
  AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
97
119
  AVFormatIDKeyIOS: AVEncodingOption.aac,
98
- AVModeIOS: AVModeIOSOption.spokenaudio,
120
+ AVModeIOS: AudioRecorderPackageNitroSound
121
+ ? AVModeIOSOptionNitroSound.spokenaudio
122
+ : AVModeIOSOption.spokenaudio,
99
123
  AVNumberOfChannelsKeyIOS: 2,
100
- OutputFormatAndroid: OutputFormatAndroidType.AAC_ADTS,
101
124
  },
102
125
  isMeteringEnabled: true,
103
126
  },
@@ -134,7 +157,7 @@ class _Audio {
134
157
  ios: 'sound.aac',
135
158
  });
136
159
  const recording = await audioRecorderPlayer.startRecorder(
137
- path,
160
+ AudioRecorderPackageAudioRecorderPlayer ? path : undefined,
138
161
  this.audioRecordingConfiguration.options.audioSet,
139
162
  this.audioRecordingConfiguration.options.isMeteringEnabled,
140
163
  );