@stream-io/video-react-native-sdk 0.0.11 → 0.0.13

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -2
  3. package/dist/commonjs/components/Call/CallControls/ToggleAudioPreviewButton.js +3 -3
  4. package/dist/commonjs/components/Call/CallControls/ToggleAudioPreviewButton.js.map +1 -1
  5. package/dist/commonjs/components/Call/CallControls/ToggleVideoPreviewButton.js +3 -3
  6. package/dist/commonjs/components/Call/CallControls/ToggleVideoPreviewButton.js.map +1 -1
  7. package/dist/commonjs/providers/MediaStreamManagement.js +69 -28
  8. package/dist/commonjs/providers/MediaStreamManagement.js.map +1 -1
  9. package/dist/commonjs/providers/StreamVideo.js +1 -2
  10. package/dist/commonjs/providers/StreamVideo.js.map +1 -1
  11. package/dist/commonjs/translations/en.json +1 -3
  12. package/dist/commonjs/utils/StreamVideoRN/index.js +0 -16
  13. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  14. package/dist/commonjs/version.js +1 -1
  15. package/dist/module/components/Call/CallControls/ToggleAudioPreviewButton.js +3 -3
  16. package/dist/module/components/Call/CallControls/ToggleAudioPreviewButton.js.map +1 -1
  17. package/dist/module/components/Call/CallControls/ToggleVideoPreviewButton.js +3 -3
  18. package/dist/module/components/Call/CallControls/ToggleVideoPreviewButton.js.map +1 -1
  19. package/dist/module/providers/MediaStreamManagement.js +71 -30
  20. package/dist/module/providers/MediaStreamManagement.js.map +1 -1
  21. package/dist/module/providers/StreamVideo.js +1 -2
  22. package/dist/module/providers/StreamVideo.js.map +1 -1
  23. package/dist/module/translations/en.json +1 -3
  24. package/dist/module/utils/StreamVideoRN/index.js +0 -16
  25. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  26. package/dist/module/version.js +1 -1
  27. package/dist/typescript/components/Call/CallControls/ToggleVideoPreviewButton.d.ts.map +1 -1
  28. package/dist/typescript/providers/MediaStreamManagement.d.ts +1 -1
  29. package/dist/typescript/providers/MediaStreamManagement.d.ts.map +1 -1
  30. package/dist/typescript/providers/StreamVideo.d.ts.map +1 -1
  31. package/dist/typescript/translations/index.d.ts +0 -2
  32. package/dist/typescript/translations/index.d.ts.map +1 -1
  33. package/dist/typescript/utils/StreamVideoRN/index.d.ts +0 -10
  34. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  35. package/dist/typescript/version.d.ts +1 -1
  36. package/package.json +3 -3
  37. package/src/components/Call/CallControls/ToggleAudioPreviewButton.tsx +3 -3
  38. package/src/components/Call/CallControls/ToggleVideoPreviewButton.tsx +4 -3
  39. package/src/providers/MediaStreamManagement.tsx +80 -51
  40. package/src/providers/StreamVideo.tsx +0 -2
  41. package/src/translations/en.json +1 -3
  42. package/src/utils/StreamVideoRN/index.ts +0 -21
  43. package/src/version.ts +1 -1
  44. package/dist/commonjs/providers/MediaDevices.js +0 -59
  45. package/dist/commonjs/providers/MediaDevices.js.map +0 -1
  46. package/dist/commonjs/utils/StreamVideoRN/permissions.js +0 -24
  47. package/dist/commonjs/utils/StreamVideoRN/permissions.js.map +0 -1
  48. package/dist/module/providers/MediaDevices.js +0 -53
  49. package/dist/module/providers/MediaDevices.js.map +0 -1
  50. package/dist/module/utils/StreamVideoRN/permissions.js +0 -15
  51. package/dist/module/utils/StreamVideoRN/permissions.js.map +0 -1
  52. package/dist/typescript/providers/MediaDevices.d.ts +0 -10
  53. package/dist/typescript/providers/MediaDevices.d.ts.map +0 -1
  54. package/dist/typescript/utils/StreamVideoRN/permissions.d.ts +0 -6
  55. package/dist/typescript/utils/StreamVideoRN/permissions.d.ts.map +0 -1
  56. package/src/providers/MediaDevices.tsx +0 -61
  57. package/src/utils/StreamVideoRN/permissions.ts +0 -25
@@ -1 +0,0 @@
1
- {"version":3,"names":["switchMap","BehaviorSubject","EMPTY","isCameraPermissionGranted$","isMicPermissionGranted$","subscribeToDevicesWhenPermissionGranted","isDevicePermissionGranted$","getDevicesFunc","subscriptionCallback","pipe","isDevicePermissionGranted","subscribe"],"sourceRoot":"../../../../src","sources":["utils/StreamVideoRN/permissions.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,gBAAgB;AAC1C,SAASC,eAAe,EAAEC,KAAK,QAAoB,MAAM;AAEzD,OAAO,MAAMC,0BAA0B,GAAG,IAAIF,eAAe,CAAU,KAAK,CAAC;AAC7E,OAAO,MAAMG,uBAAuB,GAAG,IAAIH,eAAe,CAAU,KAAK,CAAC;AAE1E,OAAO,MAAMI,uCAAuC,GAAGA,CACrDC,0BAAoD,EACpDC,cAAmD,EACnDC,oBAA+D,KAE/DF,0BAA0B,CACvBG,IAAI,CACHT,SAAS,CAAEU,yBAAyB,IAAK;EACvC;EACA;EACA;EACA,IAAI,CAACA,yBAAyB,EAAE;IAC9B;IACA,OAAOR,KAAK;EACd;EACA,OAAOK,cAAc,CAAC,CAAC;AACzB,CAAC,CACH,CAAC,CACAI,SAAS,CAACH,oBAAoB,CAAC"}
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- /**
3
- * A renderless component that provides the audio and video devices to the store
4
- * This component must be a child of StreamVideoStoreProvider
5
- * @internal
6
- *
7
- * @category Device Management
8
- */
9
- export declare const MediaDevices: () => React.ReactElement | null;
10
- //# sourceMappingURL=MediaDevices.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MediaDevices.d.ts","sourceRoot":"","sources":["../../../src/providers/MediaDevices.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AASjD;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,QAAO,MAAM,YAAY,GAAG,IA4CpD,CAAC"}
@@ -1,6 +0,0 @@
1
- import { BehaviorSubject, Observable } from 'rxjs';
2
- import { MediaDeviceInfo } from '../../contexts';
3
- export declare const isCameraPermissionGranted$: BehaviorSubject<boolean>;
4
- export declare const isMicPermissionGranted$: BehaviorSubject<boolean>;
5
- export declare const subscribeToDevicesWhenPermissionGranted: (isDevicePermissionGranted$: BehaviorSubject<boolean>, getDevicesFunc: () => Observable<MediaDeviceInfo[]>, subscriptionCallback: (videoDevices: MediaDeviceInfo[]) => void) => import("rxjs").Subscription;
6
- //# sourceMappingURL=permissions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../src/utils/StreamVideoRN/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAS,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,eAAO,MAAM,0BAA0B,0BAAsC,CAAC;AAC9E,eAAO,MAAM,uBAAuB,0BAAsC,CAAC;AAE3E,eAAO,MAAM,uCAAuC,+BACtB,gBAAgB,OAAO,CAAC,kBACpC,MAAM,WAAW,eAAe,EAAE,CAAC,uCACd,eAAe,EAAE,KAAK,IAAI,gCAe7B,CAAC"}
@@ -1,61 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { getAudioDevices, getVideoDevices } from '@stream-io/video-client';
3
- import { MediaDeviceInfo, useStreamVideoStoreSetState } from '../contexts';
4
- import {
5
- isCameraPermissionGranted$,
6
- isMicPermissionGranted$,
7
- subscribeToDevicesWhenPermissionGranted,
8
- } from '../utils/StreamVideoRN/permissions';
9
-
10
- /**
11
- * A renderless component that provides the audio and video devices to the store
12
- * This component must be a child of StreamVideoStoreProvider
13
- * @internal
14
- *
15
- * @category Device Management
16
- */
17
- export const MediaDevices = (): React.ReactElement | null => {
18
- const setState = useStreamVideoStoreSetState();
19
- const initialVideoDeviceSet = useRef(false);
20
-
21
- useEffect(() => {
22
- const setAudioDevices = (audioDevices: MediaDeviceInfo[]) => {
23
- setState({ audioDevices, currentAudioDevice: audioDevices[0] });
24
- };
25
-
26
- const subscription = subscribeToDevicesWhenPermissionGranted(
27
- isMicPermissionGranted$,
28
- // @ts-expect-error Due to DOM typing incompatible with RN
29
- getAudioDevices,
30
- setAudioDevices,
31
- );
32
- return () => subscription.unsubscribe();
33
- }, [setState]);
34
-
35
- useEffect(() => {
36
- const setVideoDevices = (videoDevices: MediaDeviceInfo[]) => {
37
- if (videoDevices.length > 0 && !initialVideoDeviceSet.current) {
38
- const frontFacingVideoDevice = videoDevices.find(
39
- (videoDevice) =>
40
- videoDevice.kind === 'videoinput' && videoDevice.facing === 'front',
41
- );
42
- const initialVideoDevice = frontFacingVideoDevice ?? videoDevices[0];
43
- if (initialVideoDevice) {
44
- initialVideoDeviceSet.current = true;
45
- setState({ videoDevices, currentVideoDevice: initialVideoDevice });
46
- return;
47
- }
48
- }
49
- setState({ videoDevices });
50
- };
51
- const subscription = subscribeToDevicesWhenPermissionGranted(
52
- isCameraPermissionGranted$,
53
- // @ts-expect-error Due to DOM typing incompatible with RN
54
- getVideoDevices,
55
- setVideoDevices,
56
- );
57
- return () => subscription.unsubscribe();
58
- }, [setState]);
59
-
60
- return null;
61
- };
@@ -1,25 +0,0 @@
1
- import { switchMap } from 'rxjs/operators';
2
- import { BehaviorSubject, EMPTY, Observable } from 'rxjs';
3
- import { MediaDeviceInfo } from '../../contexts';
4
- export const isCameraPermissionGranted$ = new BehaviorSubject<boolean>(false);
5
- export const isMicPermissionGranted$ = new BehaviorSubject<boolean>(false);
6
-
7
- export const subscribeToDevicesWhenPermissionGranted = (
8
- isDevicePermissionGranted$: BehaviorSubject<boolean>,
9
- getDevicesFunc: () => Observable<MediaDeviceInfo[]>,
10
- subscriptionCallback: (videoDevices: MediaDeviceInfo[]) => void,
11
- ) =>
12
- isDevicePermissionGranted$
13
- .pipe(
14
- switchMap((isDevicePermissionGranted) => {
15
- // if we don't have mic permission, we don't need to get the audio devices
16
- // because we won't be able to use them anyway and this will trigger a permission request
17
- // from RN WebRTC lib. This is not ideal because we want to control when the permission.
18
- if (!isDevicePermissionGranted) {
19
- // otherwise return EMPTY, which is an Observable that does nothing and just completes immediately
20
- return EMPTY;
21
- }
22
- return getDevicesFunc();
23
- }),
24
- )
25
- .subscribe(subscriptionCallback);