@stream-io/video-react-sdk 0.4.8 → 0.4.10
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 +17 -0
- package/dist/index.cjs.js +1 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2 -32
- package/dist/index.es.js.map +1 -1
- package/dist/src/core/hooks/index.d.ts +0 -1
- package/package.json +3 -3
- package/src/core/hooks/index.ts +0 -1
- package/dist/src/core/hooks/useDevices.d.ts +0 -1
- package/src/core/hooks/useDevices.ts +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stream-io/video-react-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"packageManager": "yarn@3.2.4",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@floating-ui/react": "^0.26.1",
|
|
32
32
|
"@nivo/core": "^0.80.0",
|
|
33
33
|
"@nivo/line": "^0.80.0",
|
|
34
|
-
"@stream-io/video-client": "^0.4.
|
|
35
|
-
"@stream-io/video-react-bindings": "^0.3.
|
|
34
|
+
"@stream-io/video-client": "^0.4.7",
|
|
35
|
+
"@stream-io/video-react-bindings": "^0.3.7",
|
|
36
36
|
"clsx": "^2.0.0",
|
|
37
37
|
"prop-types": "^15.8.1"
|
|
38
38
|
},
|
package/src/core/hooks/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useHasBrowserPermissions: (permissionName: PermissionName) => boolean;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useHasBrowserPermissions = (permissionName: PermissionName) => {
|
|
4
|
-
const [canSubscribe, enableSubscription] = useState(false);
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
let permissionState: PermissionStatus;
|
|
8
|
-
const handlePermissionChange = (e: Event) => {
|
|
9
|
-
const { state } = (e as unknown as ChangeEvent<PermissionStatus>).target;
|
|
10
|
-
enableSubscription(state === 'granted');
|
|
11
|
-
};
|
|
12
|
-
const checkPermissions = async () => {
|
|
13
|
-
try {
|
|
14
|
-
permissionState = await navigator.permissions.query({
|
|
15
|
-
name: permissionName,
|
|
16
|
-
});
|
|
17
|
-
permissionState.addEventListener('change', handlePermissionChange);
|
|
18
|
-
enableSubscription(permissionState.state === 'granted');
|
|
19
|
-
} catch (e) {
|
|
20
|
-
// permission does not exist - cannot be queried
|
|
21
|
-
// an example would be Firefox - camera, neither microphone perms can be queried
|
|
22
|
-
enableSubscription(true);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
checkPermissions();
|
|
26
|
-
|
|
27
|
-
return () => {
|
|
28
|
-
permissionState?.removeEventListener('change', handlePermissionChange);
|
|
29
|
-
};
|
|
30
|
-
}, [permissionName]);
|
|
31
|
-
|
|
32
|
-
return canSubscribe;
|
|
33
|
-
};
|