@stream-io/video-react-native-sdk 1.29.4 → 1.30.1-beta.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/CHANGELOG.md +11 -0
- package/dist/commonjs/components/Call/CallContent/CallContent.js +13 -7
- package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
- package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js +50 -14
- package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
- package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js +27 -0
- package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js +19 -10
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +12 -9
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
- package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js +19 -4
- package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
- package/dist/commonjs/contexts/ThemeContext.js +14 -3
- package/dist/commonjs/contexts/ThemeContext.js.map +1 -1
- package/dist/commonjs/utils/hooks/index.js +0 -11
- package/dist/commonjs/utils/hooks/index.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/commonjs/version.js.map +1 -1
- package/dist/module/components/Call/CallContent/CallContent.js +10 -4
- package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
- package/dist/module/components/Call/CallContent/RTCViewPipIOS.js +52 -16
- package/dist/module/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
- package/dist/module/components/Call/CallContent/RTCViewPipNative.js +27 -0
- package/dist/module/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
- package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js +19 -10
- package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
- package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +15 -12
- package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
- package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js +20 -5
- package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
- package/dist/module/contexts/ThemeContext.js +13 -1
- package/dist/module/contexts/ThemeContext.js.map +1 -1
- package/dist/module/utils/hooks/index.js +0 -1
- package/dist/module/utils/hooks/index.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/version.js.map +1 -1
- package/dist/typescript/components/Call/CallContent/CallContent.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallContent/RTCViewPipIOS.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts +18 -0
- package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallLayout/CallParticipantsGrid.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts.map +1 -1
- package/dist/typescript/contexts/ThemeContext.d.ts.map +1 -1
- package/dist/typescript/utils/hooks/index.d.ts +0 -1
- package/dist/typescript/utils/hooks/index.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/dist/typescript/version.d.ts.map +1 -1
- package/ios/PictureInPicture/PictureInPictureAvatarView.swift +273 -0
- package/ios/PictureInPicture/PictureInPictureConnectionQualityIndicator.swift +162 -0
- package/ios/PictureInPicture/PictureInPictureContent.swift +173 -0
- package/ios/PictureInPicture/PictureInPictureContentState.swift +123 -0
- package/ios/PictureInPicture/PictureInPictureDelegateProxy.swift +89 -0
- package/ios/PictureInPicture/PictureInPictureEnforcedStopAdapter.swift +166 -0
- package/ios/PictureInPicture/PictureInPictureLogger.swift +16 -0
- package/ios/PictureInPicture/PictureInPictureParticipantOverlayView.swift +217 -0
- package/ios/PictureInPicture/PictureInPictureReconnectionView.swift +193 -0
- package/ios/PictureInPicture/StreamAVPictureInPictureVideoCallViewController.swift +125 -7
- package/ios/PictureInPicture/StreamPictureInPictureController.swift +237 -63
- package/ios/PictureInPicture/StreamPictureInPictureControllerProtocol.swift +30 -0
- package/ios/PictureInPicture/StreamPictureInPictureVideoRenderer.swift +384 -12
- package/ios/RTCViewPip.swift +187 -21
- package/ios/RTCViewPipManager.mm +9 -0
- package/ios/RTCViewPipManager.swift +3 -3
- package/ios/StreamVideoReactNative.xcodeproj/project.xcworkspace/xcuserdata/santhoshvaiyapuri.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StreamVideoReactNative.xcodeproj/xcuserdata/santhoshvaiyapuri.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/package.json +5 -7
- package/src/components/Call/CallContent/CallContent.tsx +16 -8
- package/src/components/Call/CallContent/RTCViewPipIOS.tsx +81 -15
- package/src/components/Call/CallContent/RTCViewPipNative.tsx +36 -0
- package/src/components/Call/CallLayout/CallParticipantsGrid.tsx +28 -14
- package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +19 -10
- package/src/components/Call/CallParticipantsList/CallParticipantsList.tsx +20 -5
- package/src/contexts/ThemeContext.tsx +20 -2
- package/src/utils/hooks/index.ts +0 -1
- package/src/version.ts +1 -1
- package/dist/commonjs/utils/hooks/useDebouncedValue.js +0 -24
- package/dist/commonjs/utils/hooks/useDebouncedValue.js.map +0 -1
- package/dist/module/utils/hooks/useDebouncedValue.js +0 -19
- package/dist/module/utils/hooks/useDebouncedValue.js.map +0 -1
- package/dist/typescript/utils/hooks/useDebouncedValue.d.ts +0 -8
- package/dist/typescript/utils/hooks/useDebouncedValue.d.ts.map +0 -1
- package/src/utils/hooks/useDebouncedValue.ts +0 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { StyleSheet, View, type ViewStyle } from 'react-native';
|
|
3
|
-
import { useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
4
|
-
import {
|
|
3
|
+
import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
4
|
+
import { debounceTime } from 'rxjs';
|
|
5
5
|
import {
|
|
6
6
|
CallParticipantsList as DefaultCallParticipantsList,
|
|
7
7
|
type CallParticipantsListComponentProps,
|
|
@@ -49,19 +49,33 @@ export const CallParticipantsGrid = ({
|
|
|
49
49
|
const {
|
|
50
50
|
theme: { colors, callParticipantsGrid },
|
|
51
51
|
} = useTheme();
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
useParticipants,
|
|
55
|
-
useLocalParticipant,
|
|
56
|
-
useDominantSpeaker,
|
|
57
|
-
} = useCallStateHooks();
|
|
58
|
-
const _remoteParticipants = useRemoteParticipants();
|
|
52
|
+
const call = useCall();
|
|
53
|
+
const { useLocalParticipant, useDominantSpeaker } = useCallStateHooks();
|
|
59
54
|
const localParticipant = useLocalParticipant();
|
|
60
|
-
const _allParticipants = useParticipants();
|
|
61
55
|
const dominantSpeaker = useDominantSpeaker();
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
const [remoteParticipants, setRemoteParticipants] = useState<
|
|
57
|
+
StreamVideoParticipant[]
|
|
58
|
+
>(() => call?.state.remoteParticipants ?? []);
|
|
59
|
+
const [allParticipants, setAllParticipants] = useState<
|
|
60
|
+
StreamVideoParticipant[]
|
|
61
|
+
>(() => call?.state.participants ?? []);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!call) {
|
|
64
|
+
setRemoteParticipants([]);
|
|
65
|
+
setAllParticipants([]);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const sub1 = call.state.remoteParticipants$
|
|
69
|
+
.pipe(debounceTime(300))
|
|
70
|
+
.subscribe(setRemoteParticipants);
|
|
71
|
+
const sub2 = call.state.participants$
|
|
72
|
+
.pipe(debounceTime(300))
|
|
73
|
+
.subscribe(setAllParticipants);
|
|
74
|
+
return () => {
|
|
75
|
+
sub1.unsubscribe();
|
|
76
|
+
sub2.unsubscribe();
|
|
77
|
+
};
|
|
78
|
+
}, [call]);
|
|
65
79
|
const landscapeStyles: ViewStyle = {
|
|
66
80
|
flexDirection: landscape ? 'row' : 'column',
|
|
67
81
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
hasScreenShare,
|
|
4
|
-
|
|
4
|
+
type StreamVideoParticipant,
|
|
5
5
|
} from '@stream-io/video-client';
|
|
6
|
-
import {
|
|
6
|
+
import { useCall } from '@stream-io/video-react-bindings';
|
|
7
7
|
import { StyleSheet, View, type ViewStyle } from 'react-native';
|
|
8
|
-
import {
|
|
8
|
+
import { debounceTime } from 'rxjs';
|
|
9
9
|
import { ComponentTestIds } from '../../../constants/TestIds';
|
|
10
10
|
import {
|
|
11
11
|
CallParticipantsList as DefaultCallParticipantsList,
|
|
@@ -56,15 +56,24 @@ export const CallParticipantsSpotlight = ({
|
|
|
56
56
|
theme: { callParticipantsSpotlight, variants },
|
|
57
57
|
} = useTheme();
|
|
58
58
|
const styles = useStyles();
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
const call = useCall();
|
|
60
|
+
const [allParticipants, setAllParticipants] = useState<
|
|
61
|
+
StreamVideoParticipant[]
|
|
62
|
+
>(() => call?.state.participants ?? []);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!call) {
|
|
65
|
+
setAllParticipants([]);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const sub = call.state.participants$
|
|
69
|
+
.pipe(debounceTime(300))
|
|
70
|
+
.subscribe(setAllParticipants);
|
|
71
|
+
return () => sub.unsubscribe();
|
|
72
|
+
}, [call]);
|
|
64
73
|
const [participantInSpotlight, ...otherParticipants] = allParticipants;
|
|
65
74
|
const isScreenShareOnSpotlight =
|
|
66
75
|
participantInSpotlight && hasScreenShare(participantInSpotlight);
|
|
67
|
-
const isUserAloneInCall =
|
|
76
|
+
const isUserAloneInCall = allParticipants.length === 1;
|
|
68
77
|
|
|
69
78
|
const isInPiP = useIsInPiPMode();
|
|
70
79
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, {
|
|
2
2
|
useCallback,
|
|
3
|
+
useEffect,
|
|
3
4
|
useMemo,
|
|
4
|
-
useReducer,
|
|
5
5
|
useRef,
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
type StreamVideoParticipantPatches,
|
|
18
18
|
VisibilityState,
|
|
19
19
|
} from '@stream-io/video-client';
|
|
20
|
-
import {
|
|
20
|
+
import { Subject, debounceTime } from 'rxjs';
|
|
21
21
|
import { useCall } from '@stream-io/video-react-bindings';
|
|
22
22
|
import { ComponentTestIds } from '../../../constants/TestIds';
|
|
23
23
|
import {
|
|
@@ -104,9 +104,24 @@ export const CallParticipantsList = ({
|
|
|
104
104
|
// we use a HashSet to track the currently viewable participants
|
|
105
105
|
// and a separate force update state to rerender the component to inform that the HashSet has changed
|
|
106
106
|
// NOTE: we use set instead of array or object for O(1) lookup, add and delete
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
107
|
+
// Lazy ref init: avoids recreating instances on every render (useRef doesn't support initializer fns)
|
|
108
|
+
const viewableParticipantSessionIds = useRef<Set<string>>(null!);
|
|
109
|
+
if (!viewableParticipantSessionIds.current) {
|
|
110
|
+
viewableParticipantSessionIds.current = new Set();
|
|
111
|
+
}
|
|
112
|
+
const forceUpdate$Ref = useRef<Subject<void>>(null!);
|
|
113
|
+
if (!forceUpdate$Ref.current) {
|
|
114
|
+
forceUpdate$Ref.current = new Subject<void>();
|
|
115
|
+
}
|
|
116
|
+
const forceUpdate$ = forceUpdate$Ref.current;
|
|
117
|
+
const [forceUpdateValue, setForceUpdateValue] = useState(0);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
const sub = forceUpdate$.pipe(debounceTime(500)).subscribe(() => {
|
|
120
|
+
setForceUpdateValue((v) => v + 1);
|
|
121
|
+
});
|
|
122
|
+
return () => sub.unsubscribe();
|
|
123
|
+
}, [forceUpdate$]);
|
|
124
|
+
const forceUpdate = useCallback(() => forceUpdate$.next(), [forceUpdate$]);
|
|
110
125
|
|
|
111
126
|
// we use a ref to store the active call object
|
|
112
127
|
// so that it can be used in the onViewableItemsChanged callback
|
|
@@ -5,8 +5,6 @@ import React, {
|
|
|
5
5
|
useMemo,
|
|
6
6
|
} from 'react';
|
|
7
7
|
|
|
8
|
-
import merge from 'lodash.merge';
|
|
9
|
-
|
|
10
8
|
import { defaultTheme, type Theme } from '../theme/theme';
|
|
11
9
|
|
|
12
10
|
export type DeepPartial<T> = {
|
|
@@ -32,6 +30,26 @@ export type ThemeContextValue = {
|
|
|
32
30
|
theme: Theme;
|
|
33
31
|
};
|
|
34
32
|
|
|
33
|
+
const isObject = (value: unknown): value is Record<string, unknown> =>
|
|
34
|
+
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
35
|
+
|
|
36
|
+
const merge = <T extends Record<string, unknown>>(
|
|
37
|
+
target: T,
|
|
38
|
+
source: DeepPartial<T>,
|
|
39
|
+
) => {
|
|
40
|
+
for (const key in source) {
|
|
41
|
+
const sourceValue = source[key];
|
|
42
|
+
if (sourceValue === undefined) continue;
|
|
43
|
+
|
|
44
|
+
const targetValue = target[key as keyof T];
|
|
45
|
+
if (isObject(sourceValue) && isObject(targetValue)) {
|
|
46
|
+
merge(targetValue, sourceValue as DeepPartial<Record<string, unknown>>);
|
|
47
|
+
} else {
|
|
48
|
+
target[key as keyof T] = sourceValue as T[keyof T];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
35
53
|
export const mergeThemes = (params: MergedThemesParams) => {
|
|
36
54
|
const { style, theme } = params;
|
|
37
55
|
const finalTheme = (
|
package/src/utils/hooks/index.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.
|
|
1
|
+
export const version = '1.30.1-beta.0';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useDebouncedValue = useDebouncedValue;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
/**
|
|
9
|
-
* this is a custom hook that takes a value and a delay and returns a debounced value
|
|
10
|
-
* @param {T} value
|
|
11
|
-
* @param {number} delay
|
|
12
|
-
* @returns {T}
|
|
13
|
-
*/
|
|
14
|
-
function useDebouncedValue(value, delay) {
|
|
15
|
-
const [debouncedValue, setDebouncedValue] = (0, _react.useState)(value);
|
|
16
|
-
(0, _react.useEffect)(() => {
|
|
17
|
-
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
18
|
-
return () => {
|
|
19
|
-
clearTimeout(timer);
|
|
20
|
-
};
|
|
21
|
-
}, [value, delay]);
|
|
22
|
-
return debouncedValue;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=useDebouncedValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useDebouncedValue","value","delay","debouncedValue","setDebouncedValue","useState","useEffect","timer","setTimeout","clearTimeout"],"sourceRoot":"../../../../src","sources":["utils/hooks/useDebouncedValue.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,iBAAiBA,CAAIC,KAAQ,EAAEC,KAAa,EAAK;EAC/D,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAG,IAAAC,eAAQ,EAAIJ,KAAK,CAAC;EAE9D,IAAAK,gBAAS,EAAC,MAAM;IACd,MAAMC,KAAK,GAAGC,UAAU,CAAC,MAAMJ,iBAAiB,CAACH,KAAK,CAAC,EAAEC,KAAK,CAAC;IAE/D,OAAO,MAAM;MACXO,YAAY,CAACF,KAAK,CAAC;IACrB,CAAC;EACH,CAAC,EAAE,CAACN,KAAK,EAAEC,KAAK,CAAC,CAAC;EAElB,OAAOC,cAAc;AACvB","ignoreList":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* this is a custom hook that takes a value and a delay and returns a debounced value
|
|
5
|
-
* @param {T} value
|
|
6
|
-
* @param {number} delay
|
|
7
|
-
* @returns {T}
|
|
8
|
-
*/
|
|
9
|
-
export function useDebouncedValue(value, delay) {
|
|
10
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
13
|
-
return () => {
|
|
14
|
-
clearTimeout(timer);
|
|
15
|
-
};
|
|
16
|
-
}, [value, delay]);
|
|
17
|
-
return debouncedValue;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=useDebouncedValue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","useDebouncedValue","value","delay","debouncedValue","setDebouncedValue","timer","setTimeout","clearTimeout"],"sourceRoot":"../../../../src","sources":["utils/hooks/useDebouncedValue.ts"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAIC,KAAQ,EAAEC,KAAa,EAAK;EAC/D,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGL,QAAQ,CAAIE,KAAK,CAAC;EAE9DH,SAAS,CAAC,MAAM;IACd,MAAMO,KAAK,GAAGC,UAAU,CAAC,MAAMF,iBAAiB,CAACH,KAAK,CAAC,EAAEC,KAAK,CAAC;IAE/D,OAAO,MAAM;MACXK,YAAY,CAACF,KAAK,CAAC;IACrB,CAAC;EACH,CAAC,EAAE,CAACJ,KAAK,EAAEC,KAAK,CAAC,CAAC;EAElB,OAAOC,cAAc;AACvB","ignoreList":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* this is a custom hook that takes a value and a delay and returns a debounced value
|
|
3
|
-
* @param {T} value
|
|
4
|
-
* @param {number} delay
|
|
5
|
-
* @returns {T}
|
|
6
|
-
*/
|
|
7
|
-
export declare function useDebouncedValue<T>(value: T, delay: number): T;
|
|
8
|
-
//# sourceMappingURL=useDebouncedValue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useDebouncedValue.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useDebouncedValue.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAY/D"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* this is a custom hook that takes a value and a delay and returns a debounced value
|
|
5
|
-
* @param {T} value
|
|
6
|
-
* @param {number} delay
|
|
7
|
-
* @returns {T}
|
|
8
|
-
*/
|
|
9
|
-
export function useDebouncedValue<T>(value: T, delay: number): T {
|
|
10
|
-
const [debouncedValue, setDebouncedValue] = useState<T>(value);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
14
|
-
|
|
15
|
-
return () => {
|
|
16
|
-
clearTimeout(timer);
|
|
17
|
-
};
|
|
18
|
-
}, [value, delay]);
|
|
19
|
-
|
|
20
|
-
return debouncedValue;
|
|
21
|
-
}
|