@stream-io/video-react-bindings 0.1.16 → 0.1.17
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 +7 -0
- package/dist/src/hooks/{call.d.ts → callStateHooks.d.ts} +52 -9
- package/dist/src/hooks/{call.js → callStateHooks.js} +81 -14
- package/dist/src/hooks/callStateHooks.js.map +1 -0
- package/dist/src/hooks/index.d.ts +8 -3
- package/dist/src/hooks/index.js +8 -3
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/permissions.js +2 -2
- package/dist/src/hooks/permissions.js.map +1 -1
- package/dist/src/hooks/store.d.ts +11 -4
- package/dist/src/hooks/store.js +18 -15
- package/dist/src/hooks/store.js.map +1 -1
- package/dist/src/hooks/{helpers/useObservableValue.d.ts → useObservableValue.d.ts} +1 -1
- package/dist/src/hooks/{helpers/useObservableValue.js → useObservableValue.js} +1 -1
- package/dist/src/hooks/useObservableValue.js.map +1 -0
- package/package.json +1 -1
- package/src/hooks/{call.ts → callStateHooks.ts} +100 -14
- package/src/hooks/index.ts +10 -3
- package/src/hooks/permissions.ts +2 -2
- package/src/hooks/store.ts +19 -16
- package/src/hooks/{helpers/useObservableValue.ts → useObservableValue.ts} +1 -1
- package/dist/src/hooks/call.js.map +0 -1
- package/dist/src/hooks/helpers/useObservableValue.js.map +0 -1
- package/dist/src/hooks/participants.d.ts +0 -44
- package/dist/src/hooks/participants.js +0 -62
- package/dist/src/hooks/participants.js.map +0 -1
- package/dist/src/hooks/user.d.ts +0 -7
- package/dist/src/hooks/user.js +0 -13
- package/dist/src/hooks/user.js.map +0 -1
- package/src/hooks/participants.ts +0 -79
- package/src/hooks/user.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.1.17](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.1.16...@stream-io/video-react-bindings-0.1.17) (2023-08-11)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Wrap all call state hooks in useCallStateHooks() ([#917](https://github.com/GetStream/stream-video-js/issues/917)) ([19f891a](https://github.com/GetStream/stream-video-js/commit/19f891aab42b725b6a1d0194bf0ef8f645ccc792))
|
|
11
|
+
|
|
5
12
|
### [0.1.16](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.1.15...@stream-io/video-react-bindings-0.1.16) (2023-08-10)
|
|
6
13
|
|
|
7
14
|
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { CallState, Comparator, StreamVideoParticipant } from '@stream-io/video-client';
|
|
2
|
+
/**
|
|
3
|
+
* Utility hook, which provides the current call's state.
|
|
4
|
+
*
|
|
5
|
+
* @category Call State
|
|
6
|
+
*/
|
|
7
|
+
export declare const useCallState: () => CallState;
|
|
1
8
|
/**
|
|
2
9
|
* Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.
|
|
3
10
|
*
|
|
@@ -41,19 +48,12 @@ export declare const useCallStatsReport: () => import("@stream-io/video-client")
|
|
|
41
48
|
*
|
|
42
49
|
* @category Call State
|
|
43
50
|
*/
|
|
44
|
-
export declare const useDominantSpeaker: () =>
|
|
45
|
-
/**
|
|
46
|
-
* Utility hook which provides a list of all notifications about created calls.
|
|
47
|
-
* In the ring call settings, these calls can be outgoing (I have called somebody)
|
|
48
|
-
* or incoming (somebody has called me).
|
|
49
|
-
*
|
|
50
|
-
* @category Client State
|
|
51
|
-
*/
|
|
52
|
-
export declare const useCalls: () => import("@stream-io/video-client").Call[];
|
|
51
|
+
export declare const useDominantSpeaker: () => StreamVideoParticipant | undefined;
|
|
53
52
|
/**
|
|
54
53
|
* Utility hook which provides call metadata (such as blocked users and own capabilities).
|
|
55
54
|
*
|
|
56
55
|
* @category Call State
|
|
56
|
+
* @deprecated will be removed in the next major release and replaced with more specific hooks.
|
|
57
57
|
*/
|
|
58
58
|
export declare const useCallMetadata: () => import("@stream-io/video-client").CallResponse | undefined;
|
|
59
59
|
/**
|
|
@@ -81,3 +81,46 @@ export declare const useCallCallingState: () => import("@stream-io/video-client"
|
|
|
81
81
|
* @category Call State
|
|
82
82
|
*/
|
|
83
83
|
export declare const useCallStartedAt: () => Date | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* A hook which provides a list of all participants that have joined an active call.
|
|
86
|
+
*
|
|
87
|
+
* @category Call State
|
|
88
|
+
*
|
|
89
|
+
* @param options.sortBy - A comparator function to sort the participants by.
|
|
90
|
+
* Make sure to memoize output of the `combineComparators` function
|
|
91
|
+
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
92
|
+
*/
|
|
93
|
+
export declare const useParticipants: ({ sortBy, }?: {
|
|
94
|
+
/**
|
|
95
|
+
* Make sure to memoize output of the `combineComparators` function
|
|
96
|
+
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
97
|
+
*/
|
|
98
|
+
sortBy?: Comparator<StreamVideoParticipant> | undefined;
|
|
99
|
+
}) => (StreamVideoParticipant | import("@stream-io/video-client").StreamVideoLocalParticipant)[];
|
|
100
|
+
/**
|
|
101
|
+
* A hook which provides a StreamVideoLocalParticipant object.
|
|
102
|
+
* It signals that I have joined a call.
|
|
103
|
+
*
|
|
104
|
+
* @category Call State
|
|
105
|
+
*/
|
|
106
|
+
export declare const useLocalParticipant: () => import("@stream-io/video-client").StreamVideoLocalParticipant | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* A hook which provides a list of all other participants than me that have joined an active call.
|
|
109
|
+
*
|
|
110
|
+
* @category Call State
|
|
111
|
+
*/
|
|
112
|
+
export declare const useRemoteParticipants: () => StreamVideoParticipant[];
|
|
113
|
+
/**
|
|
114
|
+
* Returns the approximate participant count of the active call.
|
|
115
|
+
* This includes the anonymous users as well, and it is computed on the server.
|
|
116
|
+
*
|
|
117
|
+
* @category Call State
|
|
118
|
+
*/
|
|
119
|
+
export declare const useParticipantCount: () => number;
|
|
120
|
+
/**
|
|
121
|
+
* Returns the approximate anonymous participant count of the active call.
|
|
122
|
+
* The regular participants are not included in this count. It is computed on the server.
|
|
123
|
+
*
|
|
124
|
+
* @category Call State
|
|
125
|
+
*/
|
|
126
|
+
export declare const useAnonymousParticipantCount: () => number;
|
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { CallState, } from '@stream-io/video-client';
|
|
3
|
+
import { useCall } from '../contexts';
|
|
4
|
+
import { useObservableValue } from './useObservableValue';
|
|
5
|
+
/**
|
|
6
|
+
* Utility hook, which provides the current call's state.
|
|
7
|
+
*
|
|
8
|
+
* @category Call State
|
|
9
|
+
*/
|
|
10
|
+
export const useCallState = () => {
|
|
11
|
+
const call = useCall();
|
|
12
|
+
// return an empty and unlinked CallState object if there is no call in the provider
|
|
13
|
+
// this ensures that the hooks always return a value and many null checks can be avoided
|
|
14
|
+
if (!call) {
|
|
15
|
+
const message = 'You are using useCallState() outside a Call context. ' +
|
|
16
|
+
'Please wrap your component in <StreamCall /> and provide a "call" instance.';
|
|
17
|
+
console.warn(message);
|
|
18
|
+
return new CallState();
|
|
19
|
+
}
|
|
20
|
+
return call.state;
|
|
21
|
+
};
|
|
3
22
|
/**
|
|
4
23
|
* Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.
|
|
5
24
|
*
|
|
@@ -64,21 +83,11 @@ export const useDominantSpeaker = () => {
|
|
|
64
83
|
const { dominantSpeaker$ } = useCallState();
|
|
65
84
|
return useObservableValue(dominantSpeaker$);
|
|
66
85
|
};
|
|
67
|
-
/**
|
|
68
|
-
* Utility hook which provides a list of all notifications about created calls.
|
|
69
|
-
* In the ring call settings, these calls can be outgoing (I have called somebody)
|
|
70
|
-
* or incoming (somebody has called me).
|
|
71
|
-
*
|
|
72
|
-
* @category Client State
|
|
73
|
-
*/
|
|
74
|
-
export const useCalls = () => {
|
|
75
|
-
const { calls$ } = useStore();
|
|
76
|
-
return useObservableValue(calls$);
|
|
77
|
-
};
|
|
78
86
|
/**
|
|
79
87
|
* Utility hook which provides call metadata (such as blocked users and own capabilities).
|
|
80
88
|
*
|
|
81
89
|
* @category Call State
|
|
90
|
+
* @deprecated will be removed in the next major release and replaced with more specific hooks.
|
|
82
91
|
*/
|
|
83
92
|
export const useCallMetadata = () => {
|
|
84
93
|
const { metadata$ } = useCallState();
|
|
@@ -121,4 +130,62 @@ export const useCallStartedAt = () => {
|
|
|
121
130
|
const { startedAt$ } = useCallState();
|
|
122
131
|
return useObservableValue(startedAt$);
|
|
123
132
|
};
|
|
124
|
-
|
|
133
|
+
/**
|
|
134
|
+
* A hook which provides a list of all participants that have joined an active call.
|
|
135
|
+
*
|
|
136
|
+
* @category Call State
|
|
137
|
+
*
|
|
138
|
+
* @param options.sortBy - A comparator function to sort the participants by.
|
|
139
|
+
* Make sure to memoize output of the `combineComparators` function
|
|
140
|
+
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
141
|
+
*/
|
|
142
|
+
export const useParticipants = ({ sortBy, } = {}) => {
|
|
143
|
+
const { participants$ } = useCallState();
|
|
144
|
+
const participants = useObservableValue(participants$);
|
|
145
|
+
return useMemo(() => {
|
|
146
|
+
if (sortBy) {
|
|
147
|
+
return [...participants].sort(sortBy);
|
|
148
|
+
}
|
|
149
|
+
return participants;
|
|
150
|
+
}, [participants, sortBy]);
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* A hook which provides a StreamVideoLocalParticipant object.
|
|
154
|
+
* It signals that I have joined a call.
|
|
155
|
+
*
|
|
156
|
+
* @category Call State
|
|
157
|
+
*/
|
|
158
|
+
export const useLocalParticipant = () => {
|
|
159
|
+
const { localParticipant$ } = useCallState();
|
|
160
|
+
return useObservableValue(localParticipant$);
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* A hook which provides a list of all other participants than me that have joined an active call.
|
|
164
|
+
*
|
|
165
|
+
* @category Call State
|
|
166
|
+
*/
|
|
167
|
+
export const useRemoteParticipants = () => {
|
|
168
|
+
const { remoteParticipants$ } = useCallState();
|
|
169
|
+
return useObservableValue(remoteParticipants$);
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Returns the approximate participant count of the active call.
|
|
173
|
+
* This includes the anonymous users as well, and it is computed on the server.
|
|
174
|
+
*
|
|
175
|
+
* @category Call State
|
|
176
|
+
*/
|
|
177
|
+
export const useParticipantCount = () => {
|
|
178
|
+
const { participantCount$ } = useCallState();
|
|
179
|
+
return useObservableValue(participantCount$);
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Returns the approximate anonymous participant count of the active call.
|
|
183
|
+
* The regular participants are not included in this count. It is computed on the server.
|
|
184
|
+
*
|
|
185
|
+
* @category Call State
|
|
186
|
+
*/
|
|
187
|
+
export const useAnonymousParticipantCount = () => {
|
|
188
|
+
const { anonymousParticipantCount$ } = useCallState();
|
|
189
|
+
return useObservableValue(anonymousParticipantCount$);
|
|
190
|
+
};
|
|
191
|
+
//# sourceMappingURL=callStateHooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callStateHooks.js","sourceRoot":"","sources":["../../../src/hooks/callStateHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,SAAS,GAGV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,oFAAoF;IACpF,wFAAwF;IACxF,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,OAAO,GACX,uDAAuD;YAC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export * from './store';
|
|
5
|
-
export * from './
|
|
4
|
+
export * from './callStateHooks';
|
|
5
|
+
/**
|
|
6
|
+
* A hook-alike function that exposes all call state hooks.
|
|
7
|
+
*
|
|
8
|
+
* @category Call State
|
|
9
|
+
*/
|
|
10
|
+
export declare const useCallStateHooks: () => typeof CallStateHooks;
|
package/dist/src/hooks/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './participants';
|
|
1
|
+
import * as CallStateHooks from './callStateHooks';
|
|
3
2
|
export * from './permissions';
|
|
4
3
|
export * from './store';
|
|
5
|
-
export * from './
|
|
4
|
+
export * from './callStateHooks';
|
|
5
|
+
/**
|
|
6
|
+
* A hook-alike function that exposes all call state hooks.
|
|
7
|
+
*
|
|
8
|
+
* @category Call State
|
|
9
|
+
*/
|
|
10
|
+
export const useCallStateHooks = () => CallStateHooks;
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useCallState } from './
|
|
2
|
-
import { useObservableValue } from './
|
|
1
|
+
import { useCallState } from './callStateHooks';
|
|
2
|
+
import { useObservableValue } from './useObservableValue';
|
|
3
3
|
/**
|
|
4
4
|
* Hook that returns true if the local participant has all the given permissions.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/hooks/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/hooks/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAA4B,EAAW,EAAE;IAC5E,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;IAC1C,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAC9E,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAoB,EAAE;IACtD,MAAM,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC5C,OAAO,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAC9C,CAAC,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { CallState } from '@stream-io/video-client';
|
|
2
1
|
/**
|
|
3
2
|
* Utility hook which provides access to client's state store.
|
|
4
3
|
*/
|
|
5
4
|
export declare const useStore: () => import("@stream-io/video-client").StreamVideoReadOnlyStateStore;
|
|
6
5
|
/**
|
|
7
|
-
* Utility hook which provides
|
|
6
|
+
* Utility hook which provides a list of all notifications about created calls.
|
|
7
|
+
* In the ring call settings, these calls can be outgoing (I have called somebody)
|
|
8
|
+
* or incoming (somebody has called me).
|
|
8
9
|
*
|
|
9
|
-
* @category
|
|
10
|
+
* @category Client State
|
|
10
11
|
*/
|
|
11
|
-
export declare const
|
|
12
|
+
export declare const useCalls: () => import("@stream-io/video-client").Call[];
|
|
13
|
+
/**
|
|
14
|
+
* Returns the current connected user.
|
|
15
|
+
*
|
|
16
|
+
* @category Client State
|
|
17
|
+
*/
|
|
18
|
+
export declare const useConnectedUser: () => import("@stream-io/video-client").OwnUserResponse | undefined;
|
package/dist/src/hooks/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useStreamVideoClient } from '../contexts';
|
|
2
|
+
import { useObservableValue } from './useObservableValue';
|
|
3
3
|
/**
|
|
4
4
|
* Utility hook which provides access to client's state store.
|
|
5
5
|
*/
|
|
@@ -11,20 +11,23 @@ export const useStore = () => {
|
|
|
11
11
|
return client.readOnlyStateStore;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* Utility hook which provides
|
|
14
|
+
* Utility hook which provides a list of all notifications about created calls.
|
|
15
|
+
* In the ring call settings, these calls can be outgoing (I have called somebody)
|
|
16
|
+
* or incoming (somebody has called me).
|
|
15
17
|
*
|
|
16
|
-
* @category
|
|
18
|
+
* @category Client State
|
|
17
19
|
*/
|
|
18
|
-
export const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
export const useCalls = () => {
|
|
21
|
+
const { calls$ } = useStore();
|
|
22
|
+
return useObservableValue(calls$);
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Returns the current connected user.
|
|
26
|
+
*
|
|
27
|
+
* @category Client State
|
|
28
|
+
*/
|
|
29
|
+
export const useConnectedUser = () => {
|
|
30
|
+
const { connectedUser$ } = useStore();
|
|
31
|
+
return useObservableValue(connectedUser$);
|
|
29
32
|
};
|
|
30
33
|
//# sourceMappingURL=store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/hooks/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/hooks/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAC;KACH;IACD,OAAO,MAAM,CAAC,kBAAkB,CAAC;AACnC,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtC,OAAO,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useObservableValue.js","sourceRoot":"","sources":["../../../src/hooks/useObservableValue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAI,WAA0B,EAAE,EAAE;IAClE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAI,GAAG,EAAE,CACzC,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CACrC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
CallState,
|
|
4
|
+
Comparator,
|
|
5
|
+
StreamVideoParticipant,
|
|
6
|
+
} from '@stream-io/video-client';
|
|
7
|
+
import { useCall } from '../contexts';
|
|
8
|
+
import { useObservableValue } from './useObservableValue';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Utility hook, which provides the current call's state.
|
|
12
|
+
*
|
|
13
|
+
* @category Call State
|
|
14
|
+
*/
|
|
15
|
+
export const useCallState = () => {
|
|
16
|
+
const call = useCall();
|
|
17
|
+
// return an empty and unlinked CallState object if there is no call in the provider
|
|
18
|
+
// this ensures that the hooks always return a value and many null checks can be avoided
|
|
19
|
+
if (!call) {
|
|
20
|
+
const message =
|
|
21
|
+
'You are using useCallState() outside a Call context. ' +
|
|
22
|
+
'Please wrap your component in <StreamCall /> and provide a "call" instance.';
|
|
23
|
+
console.warn(message);
|
|
24
|
+
return new CallState();
|
|
25
|
+
}
|
|
26
|
+
return call.state;
|
|
27
|
+
};
|
|
3
28
|
|
|
4
29
|
/**
|
|
5
30
|
* Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.
|
|
@@ -70,22 +95,11 @@ export const useDominantSpeaker = () => {
|
|
|
70
95
|
return useObservableValue(dominantSpeaker$);
|
|
71
96
|
};
|
|
72
97
|
|
|
73
|
-
/**
|
|
74
|
-
* Utility hook which provides a list of all notifications about created calls.
|
|
75
|
-
* In the ring call settings, these calls can be outgoing (I have called somebody)
|
|
76
|
-
* or incoming (somebody has called me).
|
|
77
|
-
*
|
|
78
|
-
* @category Client State
|
|
79
|
-
*/
|
|
80
|
-
export const useCalls = () => {
|
|
81
|
-
const { calls$ } = useStore();
|
|
82
|
-
return useObservableValue(calls$);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
98
|
/**
|
|
86
99
|
* Utility hook which provides call metadata (such as blocked users and own capabilities).
|
|
87
100
|
*
|
|
88
101
|
* @category Call State
|
|
102
|
+
* @deprecated will be removed in the next major release and replaced with more specific hooks.
|
|
89
103
|
*/
|
|
90
104
|
export const useCallMetadata = () => {
|
|
91
105
|
const { metadata$ } = useCallState();
|
|
@@ -132,3 +146,75 @@ export const useCallStartedAt = () => {
|
|
|
132
146
|
const { startedAt$ } = useCallState();
|
|
133
147
|
return useObservableValue(startedAt$);
|
|
134
148
|
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* A hook which provides a list of all participants that have joined an active call.
|
|
152
|
+
*
|
|
153
|
+
* @category Call State
|
|
154
|
+
*
|
|
155
|
+
* @param options.sortBy - A comparator function to sort the participants by.
|
|
156
|
+
* Make sure to memoize output of the `combineComparators` function
|
|
157
|
+
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
158
|
+
*/
|
|
159
|
+
export const useParticipants = ({
|
|
160
|
+
sortBy,
|
|
161
|
+
}: {
|
|
162
|
+
/**
|
|
163
|
+
* Make sure to memoize output of the `combineComparators` function
|
|
164
|
+
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
165
|
+
*/
|
|
166
|
+
sortBy?: Comparator<StreamVideoParticipant>;
|
|
167
|
+
} = {}) => {
|
|
168
|
+
const { participants$ } = useCallState();
|
|
169
|
+
const participants = useObservableValue(participants$);
|
|
170
|
+
|
|
171
|
+
return useMemo(() => {
|
|
172
|
+
if (sortBy) {
|
|
173
|
+
return [...participants].sort(sortBy);
|
|
174
|
+
}
|
|
175
|
+
return participants;
|
|
176
|
+
}, [participants, sortBy]);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* A hook which provides a StreamVideoLocalParticipant object.
|
|
181
|
+
* It signals that I have joined a call.
|
|
182
|
+
*
|
|
183
|
+
* @category Call State
|
|
184
|
+
*/
|
|
185
|
+
export const useLocalParticipant = () => {
|
|
186
|
+
const { localParticipant$ } = useCallState();
|
|
187
|
+
return useObservableValue(localParticipant$);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A hook which provides a list of all other participants than me that have joined an active call.
|
|
192
|
+
*
|
|
193
|
+
* @category Call State
|
|
194
|
+
*/
|
|
195
|
+
export const useRemoteParticipants = () => {
|
|
196
|
+
const { remoteParticipants$ } = useCallState();
|
|
197
|
+
return useObservableValue(remoteParticipants$);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Returns the approximate participant count of the active call.
|
|
202
|
+
* This includes the anonymous users as well, and it is computed on the server.
|
|
203
|
+
*
|
|
204
|
+
* @category Call State
|
|
205
|
+
*/
|
|
206
|
+
export const useParticipantCount = () => {
|
|
207
|
+
const { participantCount$ } = useCallState();
|
|
208
|
+
return useObservableValue(participantCount$);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Returns the approximate anonymous participant count of the active call.
|
|
213
|
+
* The regular participants are not included in this count. It is computed on the server.
|
|
214
|
+
*
|
|
215
|
+
* @category Call State
|
|
216
|
+
*/
|
|
217
|
+
export const useAnonymousParticipantCount = () => {
|
|
218
|
+
const { anonymousParticipantCount$ } = useCallState();
|
|
219
|
+
return useObservableValue(anonymousParticipantCount$);
|
|
220
|
+
};
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as CallStateHooks from './callStateHooks';
|
|
2
|
+
|
|
3
3
|
export * from './permissions';
|
|
4
4
|
export * from './store';
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './callStateHooks';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A hook-alike function that exposes all call state hooks.
|
|
9
|
+
*
|
|
10
|
+
* @category Call State
|
|
11
|
+
*/
|
|
12
|
+
export const useCallStateHooks = () => CallStateHooks;
|
package/src/hooks/permissions.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OwnCapability } from '@stream-io/video-client';
|
|
2
|
-
import { useCallState } from './
|
|
3
|
-
import { useObservableValue } from './
|
|
2
|
+
import { useCallState } from './callStateHooks';
|
|
3
|
+
import { useObservableValue } from './useObservableValue';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Hook that returns true if the local participant has all the given permissions.
|
package/src/hooks/store.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useStreamVideoClient } from '../contexts';
|
|
2
|
+
import { useObservableValue } from './useObservableValue';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Utility hook which provides access to client's state store.
|
|
@@ -15,20 +15,23 @@ export const useStore = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Utility hook which provides
|
|
18
|
+
* Utility hook which provides a list of all notifications about created calls.
|
|
19
|
+
* In the ring call settings, these calls can be outgoing (I have called somebody)
|
|
20
|
+
* or incoming (somebody has called me).
|
|
19
21
|
*
|
|
20
|
-
* @category
|
|
22
|
+
* @category Client State
|
|
21
23
|
*/
|
|
22
|
-
export const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
export const useCalls = () => {
|
|
25
|
+
const { calls$ } = useStore();
|
|
26
|
+
return useObservableValue(calls$);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns the current connected user.
|
|
31
|
+
*
|
|
32
|
+
* @category Client State
|
|
33
|
+
*/
|
|
34
|
+
export const useConnectedUser = () => {
|
|
35
|
+
const { connectedUser$ } = useStore();
|
|
36
|
+
return useObservableValue(connectedUser$);
|
|
34
37
|
};
|
|
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import { RxUtils } from '@stream-io/video-client';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Utility hook which provides the current value of the given observable.
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export const useObservableValue = <T>(observable$: Observable<T>) => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../../src/hooks/call.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,OAAO,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,SAAS,CAAA,CAAC;AAC/B,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,OAAO,CAAC,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,YAAY,CAAA,CAAC;AACzC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,C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AC;AACf,CAAC,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Comparator, StreamVideoParticipant } from '@stream-io/video-client';
|
|
2
|
-
/**
|
|
3
|
-
* A hook which provides a list of all participants that have joined an active call.
|
|
4
|
-
*
|
|
5
|
-
* @category Call State
|
|
6
|
-
*
|
|
7
|
-
* @param options.sortBy - A comparator function to sort the participants by.
|
|
8
|
-
* Make sure to memoize output of the `combineComparators` function
|
|
9
|
-
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
10
|
-
*/
|
|
11
|
-
export declare const useParticipants: ({ sortBy, }?: {
|
|
12
|
-
/**
|
|
13
|
-
* Make sure to memoize output of the `combineComparators` function
|
|
14
|
-
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
15
|
-
*/
|
|
16
|
-
sortBy?: Comparator<StreamVideoParticipant> | undefined;
|
|
17
|
-
}) => (StreamVideoParticipant | import("@stream-io/video-client").StreamVideoLocalParticipant)[];
|
|
18
|
-
/**
|
|
19
|
-
* A hook which provides a StreamVideoLocalParticipant object.
|
|
20
|
-
* It signals that I have joined a call.
|
|
21
|
-
*
|
|
22
|
-
* @category Call State
|
|
23
|
-
*/
|
|
24
|
-
export declare const useLocalParticipant: () => import("@stream-io/video-client").StreamVideoLocalParticipant | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* A hook which provides a list of all other participants than me that have joined an active call.
|
|
27
|
-
*
|
|
28
|
-
* @category Call State
|
|
29
|
-
*/
|
|
30
|
-
export declare const useRemoteParticipants: () => StreamVideoParticipant[];
|
|
31
|
-
/**
|
|
32
|
-
* Returns the approximate participant count of the active call.
|
|
33
|
-
* This includes the anonymous users as well, and it is computed on the server.
|
|
34
|
-
*
|
|
35
|
-
* @category Call State
|
|
36
|
-
*/
|
|
37
|
-
export declare const useParticipantCount: () => number;
|
|
38
|
-
/**
|
|
39
|
-
* Returns the approximate anonymous participant count of the active call.
|
|
40
|
-
* The regular participants are not included in this count. It is computed on the server.
|
|
41
|
-
*
|
|
42
|
-
* @category Call State
|
|
43
|
-
*/
|
|
44
|
-
export declare const useAnonymousParticipantCount: () => number;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { useObservableValue } from './helpers/useObservableValue';
|
|
2
|
-
import { useCallState } from './store';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
/**
|
|
5
|
-
* A hook which provides a list of all participants that have joined an active call.
|
|
6
|
-
*
|
|
7
|
-
* @category Call State
|
|
8
|
-
*
|
|
9
|
-
* @param options.sortBy - A comparator function to sort the participants by.
|
|
10
|
-
* Make sure to memoize output of the `combineComparators` function
|
|
11
|
-
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
12
|
-
*/
|
|
13
|
-
export const useParticipants = ({ sortBy, } = {}) => {
|
|
14
|
-
const { participants$ } = useCallState();
|
|
15
|
-
const participants = useObservableValue(participants$);
|
|
16
|
-
return useMemo(() => {
|
|
17
|
-
if (sortBy) {
|
|
18
|
-
return [...participants].sort(sortBy);
|
|
19
|
-
}
|
|
20
|
-
return participants;
|
|
21
|
-
}, [participants, sortBy]);
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* A hook which provides a StreamVideoLocalParticipant object.
|
|
25
|
-
* It signals that I have joined a call.
|
|
26
|
-
*
|
|
27
|
-
* @category Call State
|
|
28
|
-
*/
|
|
29
|
-
export const useLocalParticipant = () => {
|
|
30
|
-
const { localParticipant$ } = useCallState();
|
|
31
|
-
return useObservableValue(localParticipant$);
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* A hook which provides a list of all other participants than me that have joined an active call.
|
|
35
|
-
*
|
|
36
|
-
* @category Call State
|
|
37
|
-
*/
|
|
38
|
-
export const useRemoteParticipants = () => {
|
|
39
|
-
const { remoteParticipants$ } = useCallState();
|
|
40
|
-
return useObservableValue(remoteParticipants$);
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Returns the approximate participant count of the active call.
|
|
44
|
-
* This includes the anonymous users as well, and it is computed on the server.
|
|
45
|
-
*
|
|
46
|
-
* @category Call State
|
|
47
|
-
*/
|
|
48
|
-
export const useParticipantCount = () => {
|
|
49
|
-
const { participantCount$ } = useCallState();
|
|
50
|
-
return useObservableValue(participantCount$);
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Returns the approximate anonymous participant count of the active call.
|
|
54
|
-
* The regular participants are not included in this count. It is computed on the server.
|
|
55
|
-
*
|
|
56
|
-
* @category Call State
|
|
57
|
-
*/
|
|
58
|
-
export const useAnonymousParticipantCount = () => {
|
|
59
|
-
const { anonymousParticipantCount$ } = useCallState();
|
|
60
|
-
return useObservableValue(anonymousParticipantCount$);
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=participants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"participants.js","sourceRoot":"","sources":["../../../src/hooks/participants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,MAAM,MAOJ,EAAE,EAAE,EAAE;IACR,MAAM,EAAE,aAAa,EAAE,GAAG,YAAY,EAAE,CAAC;IACzC,MAAM,YAAY,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAEvD,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,MAAM,EAAE;YACV,OAAO,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACvC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC7C,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,EAAE,mBAAmB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC/C,OAAO,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,EAAE,iBAAiB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC7C,OAAO,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,MAAM,EAAE,0BAA0B,EAAE,GAAG,YAAY,EAAE,CAAC;IACtD,OAAO,kBAAkB,CAAC,0BAA0B,CAAC,CAAC;AACxD,CAAC,CAAC"}
|
package/dist/src/hooks/user.d.ts
DELETED
package/dist/src/hooks/user.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useStore } from './store';
|
|
2
|
-
import { useObservableValue } from './helpers/useObservableValue';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @returns
|
|
6
|
-
*
|
|
7
|
-
* @category Client State
|
|
8
|
-
*/
|
|
9
|
-
export const useConnectedUser = () => {
|
|
10
|
-
const { connectedUser$ } = useStore();
|
|
11
|
-
return useObservableValue(connectedUser$);
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=user.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../src/hooks/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtC,OAAO,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { useObservableValue } from './helpers/useObservableValue';
|
|
2
|
-
import { useCallState } from './store';
|
|
3
|
-
import type {
|
|
4
|
-
Comparator,
|
|
5
|
-
StreamVideoParticipant,
|
|
6
|
-
} from '@stream-io/video-client';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A hook which provides a list of all participants that have joined an active call.
|
|
11
|
-
*
|
|
12
|
-
* @category Call State
|
|
13
|
-
*
|
|
14
|
-
* @param options.sortBy - A comparator function to sort the participants by.
|
|
15
|
-
* Make sure to memoize output of the `combineComparators` function
|
|
16
|
-
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
17
|
-
*/
|
|
18
|
-
export const useParticipants = ({
|
|
19
|
-
sortBy,
|
|
20
|
-
}: {
|
|
21
|
-
/**
|
|
22
|
-
* Make sure to memoize output of the `combineComparators` function
|
|
23
|
-
* (or keep it out of component's scope if possible) before passing it down to this property.
|
|
24
|
-
*/
|
|
25
|
-
sortBy?: Comparator<StreamVideoParticipant>;
|
|
26
|
-
} = {}) => {
|
|
27
|
-
const { participants$ } = useCallState();
|
|
28
|
-
const participants = useObservableValue(participants$);
|
|
29
|
-
|
|
30
|
-
return useMemo(() => {
|
|
31
|
-
if (sortBy) {
|
|
32
|
-
return [...participants].sort(sortBy);
|
|
33
|
-
}
|
|
34
|
-
return participants;
|
|
35
|
-
}, [participants, sortBy]);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* A hook which provides a StreamVideoLocalParticipant object.
|
|
40
|
-
* It signals that I have joined a call.
|
|
41
|
-
*
|
|
42
|
-
* @category Call State
|
|
43
|
-
*/
|
|
44
|
-
export const useLocalParticipant = () => {
|
|
45
|
-
const { localParticipant$ } = useCallState();
|
|
46
|
-
return useObservableValue(localParticipant$);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* A hook which provides a list of all other participants than me that have joined an active call.
|
|
51
|
-
*
|
|
52
|
-
* @category Call State
|
|
53
|
-
*/
|
|
54
|
-
export const useRemoteParticipants = () => {
|
|
55
|
-
const { remoteParticipants$ } = useCallState();
|
|
56
|
-
return useObservableValue(remoteParticipants$);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Returns the approximate participant count of the active call.
|
|
61
|
-
* This includes the anonymous users as well, and it is computed on the server.
|
|
62
|
-
*
|
|
63
|
-
* @category Call State
|
|
64
|
-
*/
|
|
65
|
-
export const useParticipantCount = () => {
|
|
66
|
-
const { participantCount$ } = useCallState();
|
|
67
|
-
return useObservableValue(participantCount$);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Returns the approximate anonymous participant count of the active call.
|
|
72
|
-
* The regular participants are not included in this count. It is computed on the server.
|
|
73
|
-
*
|
|
74
|
-
* @category Call State
|
|
75
|
-
*/
|
|
76
|
-
export const useAnonymousParticipantCount = () => {
|
|
77
|
-
const { anonymousParticipantCount$ } = useCallState();
|
|
78
|
-
return useObservableValue(anonymousParticipantCount$);
|
|
79
|
-
};
|
package/src/hooks/user.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useStore } from './store';
|
|
2
|
-
import { useObservableValue } from './helpers/useObservableValue';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* @returns
|
|
7
|
-
*
|
|
8
|
-
* @category Client State
|
|
9
|
-
*/
|
|
10
|
-
export const useConnectedUser = () => {
|
|
11
|
-
const { connectedUser$ } = useStore();
|
|
12
|
-
return useObservableValue(connectedUser$);
|
|
13
|
-
};
|