stream-chat-react-native 9.4.0-beta.9 → 9.4.0

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": "9.4.0-beta.9",
4
+ "version": "9.4.0",
5
5
  "homepage": "https://www.npmjs.com/package/stream-chat-react-native",
6
6
  "author": {
7
7
  "company": "Stream.io Inc",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "es6-symbol": "^3.1.3",
32
32
  "mime": "^4.0.7",
33
- "stream-chat-react-native-core": "9.4.0-beta.9"
33
+ "stream-chat-react-native-core": "9.4.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@react-native-camera-roll/camera-roll": ">=7.9.0",
@@ -14,10 +14,17 @@ let AudioVideoComponent:
14
14
  };
15
15
  style: StyleProp<ViewStyle>;
16
16
  audioOnly?: boolean;
17
+ bufferConfig?: {
18
+ bufferForPlaybackAfterRebufferMs?: number;
19
+ bufferForPlaybackMs?: number;
20
+ maxBufferMs?: number;
21
+ minBufferMs?: number;
22
+ };
17
23
  ignoreSilentSwitch?: 'ignore' | 'obey';
18
24
  repeat?: boolean;
19
25
  }>
20
26
  | undefined;
27
+
21
28
  try {
22
29
  const videoPackage = require('react-native-video');
23
30
  AudioVideoComponent = videoPackage.default;
@@ -2,6 +2,22 @@ import React from 'react';
2
2
 
3
3
  import AudioVideoPlayer from './AudioVideo';
4
4
 
5
+ /**
6
+ * Tuned for chat gallery clips. ExoPlayer's defaults are way too generous and
7
+ * buffer up to 50s of read ahead, which translates to ~30 MB of
8
+ * Java heap source bytes per instance - way too much when several Video elements
9
+ * are mounted in the gallery's slide window. These values cap each instance
10
+ * at roughly 5-10 MB while still giving a comfortable margin against network
11
+ * stalls. Integrators with different needs can replace this wrapper via
12
+ * `registerNativeHandlers({ Video: ... })`.
13
+ */
14
+ const BUFFER_CONFIG = {
15
+ bufferForPlaybackAfterRebufferMs: 2000,
16
+ bufferForPlaybackMs: 1000,
17
+ maxBufferMs: 10000,
18
+ minBufferMs: 5000,
19
+ };
20
+
5
21
  export const Video = AudioVideoPlayer
6
22
  ? ({
7
23
  onBuffer,
@@ -17,6 +33,7 @@ export const Video = AudioVideoPlayer
17
33
  rate,
18
34
  }) => (
19
35
  <AudioVideoPlayer
36
+ bufferConfig={BUFFER_CONFIG}
20
37
  ignoreSilentSwitch={'ignore'}
21
38
  onBuffer={onBuffer}
22
39
  onEnd={onEnd}