@stream-io/video-react-bindings 0.2.1 → 0.2.3
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 +15 -0
- package/dist/src/hooks/callStateHooks.d.ts +20 -1
- package/dist/src/hooks/callStateHooks.js +36 -1
- package/dist/src/hooks/callStateHooks.js.map +1 -1
- package/dist/src/hooks/permissions.d.ts +1 -1
- package/dist/src/hooks/permissions.js +1 -1
- package/dist/src/hooks/permissions.js.map +1 -1
- package/dist/src/wrappers/Restricted.js +1 -1
- package/dist/src/wrappers/Restricted.js.map +1 -1
- package/package.json +3 -3
- package/src/hooks/callStateHooks.ts +52 -2
- package/src/hooks/permissions.ts +2 -2
- package/src/wrappers/Restricted.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.2.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.2.2...@stream-io/video-react-bindings-0.2.3) (2023-08-16)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `@stream-io/video-client` updated to version `0.1.0`
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* use new device API in RN SDK and move to @stream-io/react-native-webrtc ([#925](https://github.com/GetStream/stream-video-js/issues/925)) ([8442d82](https://github.com/GetStream/stream-video-js/commit/8442d821a8eb97cb4be6e6d71b64337c04a86a15))
|
|
14
|
+
|
|
15
|
+
### [0.2.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.2.1...@stream-io/video-react-bindings-0.2.2) (2023-08-16)
|
|
16
|
+
|
|
17
|
+
### Dependency Updates
|
|
18
|
+
|
|
19
|
+
* `@stream-io/video-client` updated to version `0.1.0`
|
|
5
20
|
### [0.2.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.2.0...@stream-io/video-react-bindings-0.2.1) (2023-08-16)
|
|
6
21
|
|
|
7
22
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CallIngressResponse, CallSessionResponse, CallSettingsResponse,
|
|
1
|
+
import { CallState, Comparator, CallIngressResponse, CallSessionResponse, CallSettingsResponse, CallStatsReport, EgressResponse, MemberResponse, StreamVideoParticipant, UserResponse } from '@stream-io/video-client';
|
|
2
2
|
/**
|
|
3
3
|
* Utility hook, which provides the current call's state.
|
|
4
4
|
*
|
|
@@ -163,3 +163,22 @@ export declare const useParticipantCount: () => number;
|
|
|
163
163
|
* @category Call State
|
|
164
164
|
*/
|
|
165
165
|
export declare const useAnonymousParticipantCount: () => number;
|
|
166
|
+
/**
|
|
167
|
+
* Returns the camera state of the current call.
|
|
168
|
+
*
|
|
169
|
+
* @category Camera Manager State
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
172
|
+
export declare const useCameraState: () => {
|
|
173
|
+
status: import("@stream-io/video-client").InputDeviceStatus;
|
|
174
|
+
direction: import("@stream-io/video-client").CameraDirection;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Returns the microphone state of the current call.
|
|
178
|
+
*
|
|
179
|
+
* @category Microphone Manager State
|
|
180
|
+
*/
|
|
181
|
+
export declare const useMicrophoneState: () => {
|
|
182
|
+
status: import("@stream-io/video-client").InputDeviceStatus;
|
|
183
|
+
selectedDevice: string | undefined;
|
|
184
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { CallState, } from '@stream-io/video-client';
|
|
2
|
+
import { CallState, CameraManagerState, MicrophoneManagerState, } from '@stream-io/video-client';
|
|
3
3
|
import { useCall } from '../contexts';
|
|
4
4
|
import { useObservableValue } from './useObservableValue';
|
|
5
5
|
/**
|
|
@@ -262,4 +262,39 @@ export const useAnonymousParticipantCount = () => {
|
|
|
262
262
|
const { anonymousParticipantCount$ } = useCallState();
|
|
263
263
|
return useObservableValue(anonymousParticipantCount$);
|
|
264
264
|
};
|
|
265
|
+
/**
|
|
266
|
+
* Returns the camera state of the current call.
|
|
267
|
+
*
|
|
268
|
+
* @category Camera Manager State
|
|
269
|
+
*
|
|
270
|
+
*/
|
|
271
|
+
export const useCameraState = () => {
|
|
272
|
+
const call = useCall();
|
|
273
|
+
const { camera = {
|
|
274
|
+
state: new CameraManagerState(),
|
|
275
|
+
}, } = call;
|
|
276
|
+
const status = useObservableValue(camera.state.status$);
|
|
277
|
+
const direction = useObservableValue(camera.state.direction$);
|
|
278
|
+
return {
|
|
279
|
+
status,
|
|
280
|
+
direction,
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* Returns the microphone state of the current call.
|
|
285
|
+
*
|
|
286
|
+
* @category Microphone Manager State
|
|
287
|
+
*/
|
|
288
|
+
export const useMicrophoneState = () => {
|
|
289
|
+
const call = useCall();
|
|
290
|
+
const { microphone = {
|
|
291
|
+
state: new MicrophoneManagerState(),
|
|
292
|
+
}, } = call;
|
|
293
|
+
const status = useObservableValue(microphone.state.status$);
|
|
294
|
+
const selectedDevice = useObservableValue(microphone.state.selectedDevice$);
|
|
295
|
+
return {
|
|
296
|
+
status,
|
|
297
|
+
selectedDevice,
|
|
298
|
+
};
|
|
299
|
+
};
|
|
265
300
|
//# sourceMappingURL=callStateHooks.js.map
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"callStateHooks.js","sourceRoot":"","sources":["../../../src/hooks/callStateHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAEL,SAAS,EACT,kBAAkB,EA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AAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAE9D,OAAO;QACL,MAAM;QACN,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,MAAM,EACJ,UAAU,GAAG;QACX,KAAK,EAAE,IAAI,sBAAsB,EAAE;KACpC,GACF,GAAG,IAAY,CAAC;IAEjB,MAAM,MAAM,GAAG,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC5D,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAE5E,OAAO;QACL,MAAM;QACN,cAAc;KACf,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { useObservableValue } from './useObservableValue';
|
|
|
9
9
|
*/
|
|
10
10
|
export const useHasPermissions = (...permissions) => {
|
|
11
11
|
const capabilities = useOwnCapabilities();
|
|
12
|
-
return permissions.every((permission) => capabilities.includes(permission));
|
|
12
|
+
return permissions.every((permission) => capabilities === null || capabilities === void 0 ? void 0 : capabilities.includes(permission));
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* A hook which returns the local participant's own capabilities.
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAgC,EAAE;IAClE,MAAM,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC5C,OAAO,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAC9C,CAAC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { useOwnCapabilities } from '../hooks';
|
|
|
4
4
|
export const Restricted = ({ canRequestOnly, hasPermissionsOnly, requiredGrants, requireAll = true, children, }) => {
|
|
5
5
|
const call = useCall();
|
|
6
6
|
const ownCapabilities = useOwnCapabilities();
|
|
7
|
-
const hasPermissions = requiredGrants[requireAll ? 'every' : 'some']((capability) => ownCapabilities.includes(capability));
|
|
7
|
+
const hasPermissions = requiredGrants[requireAll ? 'every' : 'some']((capability) => ownCapabilities === null || ownCapabilities === void 0 ? void 0 : ownCapabilities.includes(capability));
|
|
8
8
|
if (hasPermissionsOnly)
|
|
9
9
|
return hasPermissions ? _jsx(_Fragment, { children: children }) : null;
|
|
10
10
|
const canRequest = requiredGrants.some((capability) => !!call && call.permissionsContext.canRequest(capability));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Restricted.js","sourceRoot":"","sources":["../../../src/wrappers/Restricted.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsB9C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,GAAG,IAAI,EACjB,QAAQ,GACQ,EAAE,EAAE;IACpB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAClE,CAAC,UAAU,EAAE,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"Restricted.js","sourceRoot":"","sources":["../../../src/wrappers/Restricted.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsB9C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,GAAG,IAAI,EACjB,QAAQ,GACQ,EAAE,EAAE;IACpB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAClE,CAAC,UAAU,EAAE,EAAE,CAAC,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAC,UAAU,CAAC,CACtD,CAAC;IAEF,IAAI,kBAAkB;QAAE,OAAO,cAAc,CAAC,CAAC,CAAC,4BAAG,QAAQ,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAEvE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CACpC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CACzE,CAAC;IAEF,IAAI,cAAc;QAAE,OAAO,UAAU,CAAC,CAAC,CAAC,4BAAG,QAAQ,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAE/D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAO,4BAAG,QAAQ,GAAI,CAAC;IAEzD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-react-bindings",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"@stream-io/i18n": "^0.1.1",
|
|
27
|
-
"@stream-io/video-client": "^0.3.
|
|
27
|
+
"@stream-io/video-client": "^0.3.2",
|
|
28
28
|
"react": ">=17.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@stream-io/i18n": "^0.1.1",
|
|
32
|
-
"@stream-io/video-client": "^0.3.
|
|
32
|
+
"@stream-io/video-client": "^0.3.2",
|
|
33
33
|
"@types/react": "^18.0.26",
|
|
34
34
|
"@types/rimraf": "^3.0.2",
|
|
35
35
|
"react": "^18.2.0",
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import {
|
|
3
|
+
Call,
|
|
4
|
+
CallState,
|
|
5
|
+
CameraManagerState,
|
|
6
|
+
Comparator,
|
|
7
|
+
MicrophoneManagerState,
|
|
3
8
|
CallIngressResponse,
|
|
4
9
|
CallSessionResponse,
|
|
5
10
|
CallSettingsResponse,
|
|
6
|
-
CallState,
|
|
7
11
|
CallStatsReport,
|
|
8
|
-
Comparator,
|
|
9
12
|
EgressResponse,
|
|
10
13
|
MemberResponse,
|
|
11
14
|
StreamVideoParticipant,
|
|
@@ -310,3 +313,50 @@ export const useAnonymousParticipantCount = () => {
|
|
|
310
313
|
const { anonymousParticipantCount$ } = useCallState();
|
|
311
314
|
return useObservableValue(anonymousParticipantCount$);
|
|
312
315
|
};
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Returns the camera state of the current call.
|
|
319
|
+
*
|
|
320
|
+
* @category Camera Manager State
|
|
321
|
+
*
|
|
322
|
+
*/
|
|
323
|
+
export const useCameraState = () => {
|
|
324
|
+
const call = useCall();
|
|
325
|
+
|
|
326
|
+
const {
|
|
327
|
+
camera = {
|
|
328
|
+
state: new CameraManagerState(),
|
|
329
|
+
},
|
|
330
|
+
} = call as Call;
|
|
331
|
+
|
|
332
|
+
const status = useObservableValue(camera.state.status$);
|
|
333
|
+
const direction = useObservableValue(camera.state.direction$);
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
status,
|
|
337
|
+
direction,
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Returns the microphone state of the current call.
|
|
343
|
+
*
|
|
344
|
+
* @category Microphone Manager State
|
|
345
|
+
*/
|
|
346
|
+
export const useMicrophoneState = () => {
|
|
347
|
+
const call = useCall();
|
|
348
|
+
|
|
349
|
+
const {
|
|
350
|
+
microphone = {
|
|
351
|
+
state: new MicrophoneManagerState(),
|
|
352
|
+
},
|
|
353
|
+
} = call as Call;
|
|
354
|
+
|
|
355
|
+
const status = useObservableValue(microphone.state.status$);
|
|
356
|
+
const selectedDevice = useObservableValue(microphone.state.selectedDevice$);
|
|
357
|
+
|
|
358
|
+
return {
|
|
359
|
+
status,
|
|
360
|
+
selectedDevice,
|
|
361
|
+
};
|
|
362
|
+
};
|
package/src/hooks/permissions.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { useObservableValue } from './useObservableValue';
|
|
|
11
11
|
*/
|
|
12
12
|
export const useHasPermissions = (...permissions: OwnCapability[]): boolean => {
|
|
13
13
|
const capabilities = useOwnCapabilities();
|
|
14
|
-
return permissions.every((permission) => capabilities
|
|
14
|
+
return permissions.every((permission) => capabilities?.includes(permission));
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -19,7 +19,7 @@ export const useHasPermissions = (...permissions: OwnCapability[]): boolean => {
|
|
|
19
19
|
*
|
|
20
20
|
* @category Call State
|
|
21
21
|
*/
|
|
22
|
-
export const useOwnCapabilities = (): OwnCapability[] => {
|
|
22
|
+
export const useOwnCapabilities = (): OwnCapability[] | undefined => {
|
|
23
23
|
const { ownCapabilities$ } = useCallState();
|
|
24
24
|
return useObservableValue(ownCapabilities$);
|
|
25
25
|
};
|
|
@@ -34,7 +34,7 @@ export const Restricted = ({
|
|
|
34
34
|
const call = useCall();
|
|
35
35
|
const ownCapabilities = useOwnCapabilities();
|
|
36
36
|
const hasPermissions = requiredGrants[requireAll ? 'every' : 'some'](
|
|
37
|
-
(capability) => ownCapabilities
|
|
37
|
+
(capability) => ownCapabilities?.includes(capability),
|
|
38
38
|
);
|
|
39
39
|
|
|
40
40
|
if (hasPermissionsOnly) return hasPermissions ? <>{children}</> : null;
|