@stream-io/video-react-sdk 0.0.12 → 0.0.14
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 +18 -0
- package/dist/src/core/components/StreamCall/StreamCall.d.ts +4 -66
- package/dist/src/core/components/StreamCall/StreamCall.js +3 -56
- package/dist/src/core/components/StreamCall/StreamCall.js.map +1 -1
- package/package.json +3 -3
- package/src/core/components/StreamCall/StreamCall.tsx +6 -133
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.0.14](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.0.13...@stream-io/video-react-sdk-0.0.14) (2023-06-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Documentation
|
|
9
|
+
|
|
10
|
+
* Feedback ([#609](https://github.com/GetStream/stream-video-js/issues/609)) ([3a948d1](https://github.com/GetStream/stream-video-js/commit/3a948d1b3c82ed62d95a2245e0d1a14dfae1d491))
|
|
11
|
+
|
|
12
|
+
### [0.0.13](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.0.12...@stream-io/video-react-sdk-0.0.13) (2023-06-08)
|
|
13
|
+
|
|
14
|
+
### Dependency Updates
|
|
15
|
+
|
|
16
|
+
* `@stream-io/video-client` updated to version `0.0.1`
|
|
17
|
+
* `@stream-io/video-react-bindings` updated to version `0.0.7`
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* StreamCall signature, video client creation ([#596](https://github.com/GetStream/stream-video-js/issues/596)) ([5c3000c](https://github.com/GetStream/stream-video-js/commit/5c3000cc6fc3f8b7904609d7b11fa025b7458cad))
|
|
22
|
+
|
|
5
23
|
### [0.0.12](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.0.11...@stream-io/video-react-sdk-0.0.12) (2023-06-07)
|
|
6
24
|
|
|
7
25
|
### Dependency Updates
|
|
@@ -1,73 +1,11 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { Call
|
|
2
|
+
import { Call } from '@stream-io/video-client';
|
|
3
3
|
import { MediaDevicesProviderProps } from '../../contexts';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
* The call type.
|
|
7
|
-
*/
|
|
8
|
-
callType: string;
|
|
9
|
-
/**
|
|
10
|
-
* The call id.
|
|
11
|
-
*/
|
|
12
|
-
callId: string;
|
|
13
|
-
/**
|
|
14
|
-
* The call instance to use.
|
|
15
|
-
*/
|
|
16
|
-
call?: never;
|
|
17
|
-
};
|
|
18
|
-
type InitWithCallInstance = {
|
|
19
|
-
/**
|
|
20
|
-
* The call instance to use.
|
|
21
|
-
*/
|
|
22
|
-
call: Call | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* The call type.
|
|
25
|
-
*/
|
|
26
|
-
callType?: never;
|
|
27
|
-
/**
|
|
28
|
-
* The call id.
|
|
29
|
-
*/
|
|
30
|
-
callId?: never;
|
|
31
|
-
};
|
|
32
|
-
type InitStreamCall = InitWithCallCID | InitWithCallInstance;
|
|
33
|
-
export type StreamCallProps = InitStreamCall & {
|
|
34
|
-
/**
|
|
35
|
-
* If true, the call will be joined automatically.
|
|
36
|
-
* Set it to true if you want to join the call immediately.
|
|
37
|
-
* Useful for scenarios where you want to skip prompting the user to join the call.
|
|
38
|
-
*
|
|
39
|
-
* @default false.
|
|
40
|
-
*/
|
|
41
|
-
autoJoin?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* If true, the call data will be loaded automatically from the server.
|
|
44
|
-
*
|
|
45
|
-
* This property is useful for the scenarios where you declaratively create
|
|
46
|
-
* the call instance by using the `callId` and `callType` props,
|
|
47
|
-
* and you have a UI that depends on the call metadata.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```jsx
|
|
51
|
-
* <StreamCall callId="call-id" callType="call-type" autoLoad>
|
|
52
|
-
* <CallMetadata /> // has access to `call.metadata` although not joined yet
|
|
53
|
-
* <CallUI />
|
|
54
|
-
* <CallControls />
|
|
55
|
-
* </StreamCall>
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* This property is ignored if you pass the `call` prop or enable `autoJoin`.
|
|
59
|
-
*
|
|
60
|
-
* @default true.
|
|
61
|
-
*/
|
|
62
|
-
autoLoad?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* An optional data to pass when joining the call.
|
|
65
|
-
*/
|
|
66
|
-
data?: JoinCallData;
|
|
4
|
+
export type StreamCallProps = {
|
|
5
|
+
call: Call;
|
|
67
6
|
/**
|
|
68
7
|
* An optional props to pass to the `MediaDevicesProvider`.
|
|
69
8
|
*/
|
|
70
9
|
mediaDevicesProviderProps?: MediaDevicesProviderProps;
|
|
71
10
|
};
|
|
72
|
-
export declare const StreamCall: ({ children,
|
|
73
|
-
export {};
|
|
11
|
+
export declare const StreamCall: ({ children, call, mediaDevicesProviderProps, }: PropsWithChildren<StreamCallProps>) => JSX.Element;
|
|
@@ -1,60 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { CallingState } from '@stream-io/video-client';
|
|
4
|
-
import { StreamCallProvider, useConnectedUser, useStreamVideoClient, } from '@stream-io/video-react-bindings';
|
|
2
|
+
import { StreamCallProvider } from '@stream-io/video-react-bindings';
|
|
5
3
|
import { MediaDevicesProvider, } from '../../contexts';
|
|
6
|
-
export const StreamCall = ({ children,
|
|
7
|
-
|
|
8
|
-
const [activeCall, setActiveCall] = useState(() => {
|
|
9
|
-
if (call)
|
|
10
|
-
return call;
|
|
11
|
-
if (!client || !callId || !callType)
|
|
12
|
-
return;
|
|
13
|
-
return client.call(callType, callId);
|
|
14
|
-
});
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (!client)
|
|
17
|
-
return;
|
|
18
|
-
if (callId && callType && !activeCall) {
|
|
19
|
-
const newCall = client.call(callType, callId);
|
|
20
|
-
setActiveCall(newCall);
|
|
21
|
-
}
|
|
22
|
-
}, [activeCall, callId, callType, client]);
|
|
23
|
-
const connectedUser = useConnectedUser();
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
// run the effect only when the user is connected and the call
|
|
26
|
-
// is created declaratively by using the `callId` and `callType` props.
|
|
27
|
-
if (!connectedUser)
|
|
28
|
-
return;
|
|
29
|
-
if (activeCall && callType && callId && autoLoad && !autoJoin) {
|
|
30
|
-
activeCall
|
|
31
|
-
.getOrCreate({
|
|
32
|
-
ring: data === null || data === void 0 ? void 0 : data.ring,
|
|
33
|
-
data: data === null || data === void 0 ? void 0 : data.data,
|
|
34
|
-
members_limit: data === null || data === void 0 ? void 0 : data.members_limit,
|
|
35
|
-
})
|
|
36
|
-
.catch((err) => {
|
|
37
|
-
console.error(`Failed to get or create call`, err);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}, [
|
|
41
|
-
activeCall,
|
|
42
|
-
autoJoin,
|
|
43
|
-
autoLoad,
|
|
44
|
-
callId,
|
|
45
|
-
callType,
|
|
46
|
-
connectedUser,
|
|
47
|
-
data === null || data === void 0 ? void 0 : data.data,
|
|
48
|
-
data === null || data === void 0 ? void 0 : data.members_limit,
|
|
49
|
-
data === null || data === void 0 ? void 0 : data.ring,
|
|
50
|
-
]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (autoJoin && (activeCall === null || activeCall === void 0 ? void 0 : activeCall.state.callingState) === CallingState.IDLE) {
|
|
53
|
-
activeCall.join(data).catch((err) => {
|
|
54
|
-
console.error(`Failed to join call`, err);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}, [activeCall, autoJoin, data]);
|
|
58
|
-
return (_jsx(StreamCallProvider, Object.assign({ call: activeCall }, { children: _jsx(MediaDevicesProvider, Object.assign({}, mediaDevicesProviderProps, { children: children })) })));
|
|
4
|
+
export const StreamCall = ({ children, call, mediaDevicesProviderProps, }) => {
|
|
5
|
+
return (_jsx(StreamCallProvider, Object.assign({ call: call }, { children: _jsx(MediaDevicesProvider, Object.assign({}, mediaDevicesProviderProps, { children: children })) })));
|
|
59
6
|
};
|
|
60
7
|
//# sourceMappingURL=StreamCall.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamCall.js","sourceRoot":"","sources":["../../../../../src/core/components/StreamCall/StreamCall.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"StreamCall.js","sourceRoot":"","sources":["../../../../../src/core/components/StreamCall/StreamCall.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EACL,oBAAoB,GAErB,MAAM,gBAAgB,CAAC;AAWxB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,IAAI,EACJ,yBAAyB,GACU,EAAE,EAAE;IACvC,OAAO,CACL,KAAC,kBAAkB,kBAAC,IAAI,EAAE,IAAI,gBAC5B,KAAC,oBAAoB,oBAAK,yBAAyB,cAChD,QAAQ,IACY,IACJ,CACtB,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@nivo/core": "^0.80.0",
|
|
27
27
|
"@nivo/line": "^0.80.0",
|
|
28
28
|
"@stream-io/i18n": "^0.0.2",
|
|
29
|
-
"@stream-io/video-client": "^0.0.
|
|
30
|
-
"@stream-io/video-react-bindings": "^0.0.
|
|
29
|
+
"@stream-io/video-client": "^0.0.7",
|
|
30
|
+
"@stream-io/video-react-bindings": "^0.0.7",
|
|
31
31
|
"clsx": "^1.2.1",
|
|
32
32
|
"rxjs": "~7.8.1"
|
|
33
33
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"typedoc": "^0.24.7",
|
|
48
48
|
"typescript": "^4.9.5"
|
|
49
49
|
},
|
|
50
|
-
"version": "0.0.
|
|
50
|
+
"version": "0.0.14"
|
|
51
51
|
}
|
|
@@ -1,83 +1,13 @@
|
|
|
1
|
-
import { PropsWithChildren
|
|
2
|
-
import { Call
|
|
3
|
-
import {
|
|
4
|
-
StreamCallProvider,
|
|
5
|
-
useConnectedUser,
|
|
6
|
-
useStreamVideoClient,
|
|
7
|
-
} from '@stream-io/video-react-bindings';
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { Call } from '@stream-io/video-client';
|
|
3
|
+
import { StreamCallProvider } from '@stream-io/video-react-bindings';
|
|
8
4
|
import {
|
|
9
5
|
MediaDevicesProvider,
|
|
10
6
|
MediaDevicesProviderProps,
|
|
11
7
|
} from '../../contexts';
|
|
12
8
|
|
|
13
|
-
type
|
|
14
|
-
|
|
15
|
-
* The call type.
|
|
16
|
-
*/
|
|
17
|
-
callType: string;
|
|
18
|
-
/**
|
|
19
|
-
* The call id.
|
|
20
|
-
*/
|
|
21
|
-
callId: string;
|
|
22
|
-
/**
|
|
23
|
-
* The call instance to use.
|
|
24
|
-
*/
|
|
25
|
-
call?: never;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type InitWithCallInstance = {
|
|
29
|
-
/**
|
|
30
|
-
* The call instance to use.
|
|
31
|
-
*/
|
|
32
|
-
call: Call | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* The call type.
|
|
35
|
-
*/
|
|
36
|
-
callType?: never;
|
|
37
|
-
/**
|
|
38
|
-
* The call id.
|
|
39
|
-
*/
|
|
40
|
-
callId?: never;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
type InitStreamCall = InitWithCallCID | InitWithCallInstance;
|
|
44
|
-
|
|
45
|
-
export type StreamCallProps = InitStreamCall & {
|
|
46
|
-
/**
|
|
47
|
-
* If true, the call will be joined automatically.
|
|
48
|
-
* Set it to true if you want to join the call immediately.
|
|
49
|
-
* Useful for scenarios where you want to skip prompting the user to join the call.
|
|
50
|
-
*
|
|
51
|
-
* @default false.
|
|
52
|
-
*/
|
|
53
|
-
autoJoin?: boolean;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* If true, the call data will be loaded automatically from the server.
|
|
57
|
-
*
|
|
58
|
-
* This property is useful for the scenarios where you declaratively create
|
|
59
|
-
* the call instance by using the `callId` and `callType` props,
|
|
60
|
-
* and you have a UI that depends on the call metadata.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```jsx
|
|
64
|
-
* <StreamCall callId="call-id" callType="call-type" autoLoad>
|
|
65
|
-
* <CallMetadata /> // has access to `call.metadata` although not joined yet
|
|
66
|
-
* <CallUI />
|
|
67
|
-
* <CallControls />
|
|
68
|
-
* </StreamCall>
|
|
69
|
-
* ```
|
|
70
|
-
*
|
|
71
|
-
* This property is ignored if you pass the `call` prop or enable `autoJoin`.
|
|
72
|
-
*
|
|
73
|
-
* @default true.
|
|
74
|
-
*/
|
|
75
|
-
autoLoad?: boolean;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* An optional data to pass when joining the call.
|
|
79
|
-
*/
|
|
80
|
-
data?: JoinCallData;
|
|
9
|
+
export type StreamCallProps = {
|
|
10
|
+
call: Call;
|
|
81
11
|
|
|
82
12
|
/**
|
|
83
13
|
* An optional props to pass to the `MediaDevicesProvider`.
|
|
@@ -87,68 +17,11 @@ export type StreamCallProps = InitStreamCall & {
|
|
|
87
17
|
|
|
88
18
|
export const StreamCall = ({
|
|
89
19
|
children,
|
|
90
|
-
callId,
|
|
91
|
-
callType,
|
|
92
20
|
call,
|
|
93
|
-
autoJoin = false,
|
|
94
|
-
autoLoad = true,
|
|
95
|
-
data,
|
|
96
21
|
mediaDevicesProviderProps,
|
|
97
22
|
}: PropsWithChildren<StreamCallProps>) => {
|
|
98
|
-
const client = useStreamVideoClient();
|
|
99
|
-
const [activeCall, setActiveCall] = useState<Call | undefined>(() => {
|
|
100
|
-
if (call) return call;
|
|
101
|
-
if (!client || !callId || !callType) return;
|
|
102
|
-
return client.call(callType, callId);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (!client) return;
|
|
107
|
-
|
|
108
|
-
if (callId && callType && !activeCall) {
|
|
109
|
-
const newCall = client.call(callType, callId);
|
|
110
|
-
setActiveCall(newCall);
|
|
111
|
-
}
|
|
112
|
-
}, [activeCall, callId, callType, client]);
|
|
113
|
-
|
|
114
|
-
const connectedUser = useConnectedUser();
|
|
115
|
-
useEffect(() => {
|
|
116
|
-
// run the effect only when the user is connected and the call
|
|
117
|
-
// is created declaratively by using the `callId` and `callType` props.
|
|
118
|
-
if (!connectedUser) return;
|
|
119
|
-
if (activeCall && callType && callId && autoLoad && !autoJoin) {
|
|
120
|
-
activeCall
|
|
121
|
-
.getOrCreate({
|
|
122
|
-
ring: data?.ring,
|
|
123
|
-
data: data?.data,
|
|
124
|
-
members_limit: data?.members_limit,
|
|
125
|
-
})
|
|
126
|
-
.catch((err) => {
|
|
127
|
-
console.error(`Failed to get or create call`, err);
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}, [
|
|
131
|
-
activeCall,
|
|
132
|
-
autoJoin,
|
|
133
|
-
autoLoad,
|
|
134
|
-
callId,
|
|
135
|
-
callType,
|
|
136
|
-
connectedUser,
|
|
137
|
-
data?.data,
|
|
138
|
-
data?.members_limit,
|
|
139
|
-
data?.ring,
|
|
140
|
-
]);
|
|
141
|
-
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
if (autoJoin && activeCall?.state.callingState === CallingState.IDLE) {
|
|
144
|
-
activeCall.join(data).catch((err) => {
|
|
145
|
-
console.error(`Failed to join call`, err);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}, [activeCall, autoJoin, data]);
|
|
149
|
-
|
|
150
23
|
return (
|
|
151
|
-
<StreamCallProvider call={
|
|
24
|
+
<StreamCallProvider call={call}>
|
|
152
25
|
<MediaDevicesProvider {...mediaDevicesProviderProps}>
|
|
153
26
|
{children}
|
|
154
27
|
</MediaDevicesProvider>
|