Skip to content

Commit 5acc176

Browse files
committed
Merge branch 'main' into codec-negotiation
2 parents cda1dcd + bcac386 commit 5acc176

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1389
-860
lines changed

packages/client/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
44

5+
## [1.11.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.11.0...@stream-io/video-client-1.11.1) (2024-11-14)
6+
7+
8+
### Bug Fixes
9+
10+
* reject was not called on timeout, decline and cancel scenarios ([#1576](https://github.com/GetStream/stream-video-js/issues/1576)) ([8be76a4](https://github.com/GetStream/stream-video-js/commit/8be76a447729aeba7f5c68f8a9bb85b4738cb76d))
11+
512
## [1.11.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.10.5...@stream-io/video-client-1.11.0) (2024-11-13)
613

714

packages/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stream-io/video-client",
3-
"version": "1.11.0",
3+
"version": "1.11.1",
44
"packageManager": "[email protected]",
55
"main": "dist/index.cjs.js",
66
"module": "dist/index.es.js",

packages/client/src/Call.ts

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -521,20 +521,15 @@ export class Call {
521521
await waitUntilCallJoined();
522522
}
523523

524-
if (reject && this.ringing) {
525-
// I'm the one who started the call, so I should cancel it.
526-
const hasOtherParticipants = this.state.remoteParticipants.length > 0;
527-
if (
528-
this.isCreatedByMe &&
529-
!hasOtherParticipants &&
530-
callingState === CallingState.RINGING
531-
) {
532-
// Signals other users that I have cancelled my call to them
533-
// before they accepted it.
534-
await this.reject();
535-
} else if (callingState === CallingState.RINGING) {
536-
// Signals other users that I have rejected the incoming call.
537-
await this.reject();
524+
if (callingState === CallingState.RINGING) {
525+
if (reject) {
526+
await this.reject(reason);
527+
} else {
528+
const hasOtherParticipants = this.state.remoteParticipants.length > 0;
529+
if (this.isCreatedByMe && !hasOtherParticipants) {
530+
// I'm the one who started the call, so I should cancel it when there are no other participants.
531+
await this.reject('cancel');
532+
}
538533
}
539534
}
540535

@@ -1998,13 +1993,16 @@ export class Call {
19981993
// ignore if the call is not ringing
19991994
if (this.state.callingState !== CallingState.RINGING) return;
20001995

2001-
const timeoutInMs = settings.ring.auto_cancel_timeout_ms;
1996+
const timeoutInMs = this.isCreatedByMe
1997+
? settings.ring.auto_cancel_timeout_ms
1998+
: settings.ring.incoming_call_timeout_ms;
1999+
20022000
// 0 means no auto-drop
20032001
if (timeoutInMs <= 0) return;
20042002

20052003
clearTimeout(this.dropTimeout);
20062004
this.dropTimeout = setTimeout(() => {
2007-
this.leave({ reason: 'ring: timeout' }).catch((err) => {
2005+
this.leave({ reject: true, reason: 'timeout' }).catch((err) => {
20082006
this.logger('error', 'Failed to drop call', err);
20092007
});
20102008
}, timeoutInMs);

packages/react-bindings/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
44

5+
## [1.1.18](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.17...@stream-io/video-react-bindings-1.1.18) (2024-11-14)
6+
7+
### Dependency Updates
8+
9+
* `@stream-io/video-client` updated to version `1.11.1`
510
## [1.1.17](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-1.1.16...@stream-io/video-react-bindings-1.1.17) (2024-11-13)
611

712
### Dependency Updates

packages/react-bindings/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stream-io/video-react-bindings",
3-
"version": "1.1.17",
3+
"version": "1.1.18",
44
"packageManager": "[email protected]",
55
"main": "./dist/index.cjs.js",
66
"module": "./dist/index.es.js",

packages/react-native-sdk/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
44

5+
## [1.3.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.3.0...@stream-io/video-react-native-sdk-1.3.1) (2024-11-14)
6+
7+
### Dependency Updates
8+
9+
* `@stream-io/video-client` updated to version `1.11.1`
10+
* `@stream-io/video-react-bindings` updated to version `1.1.18`
11+
12+
### Bug Fixes
13+
14+
* reject was not called on timeout, decline and cancel scenarios ([#1576](https://github.com/GetStream/stream-video-js/issues/1576)) ([8be76a4](https://github.com/GetStream/stream-video-js/commit/8be76a447729aeba7f5c68f8a9bb85b4738cb76d))
15+
16+
## [1.3.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.2.15...@stream-io/video-react-native-sdk-1.3.0) (2024-11-13)
17+
18+
19+
### Features
20+
21+
* make push notification listeners more flexible for easier debugging ([#1542](https://github.com/GetStream/stream-video-js/issues/1542)) ([75a90e6](https://github.com/GetStream/stream-video-js/commit/75a90e6239365309c83bfebfcff491b4d0046d8b)), closes [#1447](https://github.com/GetStream/stream-video-js/issues/1447)
22+
523
## [1.2.15](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-1.2.14...@stream-io/video-react-native-sdk-1.2.15) (2024-11-13)
624

725
### Dependency Updates

packages/react-native-sdk/docusaurus/docs/reactnative/04-ui-components/call/ringing-call-content.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,21 @@ To use the `RingingCallContent` you can do the following:
4949

5050
```tsx {11}
5151
import {
52+
StreamCall,
5253
useCalls,
5354
RingingCallContent,
5455
} from '@stream-io/video-react-native-sdk';
5556

5657
const Call = () => {
57-
const calls = useCalls();
58+
// filter for ringing calls
59+
const calls = useCalls().filter(
60+
(c) => c.state.callingState === CallingState.RINGING,
61+
);
62+
const call = calls[0];
63+
if (!call) return null;
5864

5965
return (
60-
<StreamCall call={call[0]}>
66+
<StreamCall call={call}>
6167
<RingingCallContent />
6268
</StreamCall>
6369
);

packages/react-native-sdk/docusaurus/docs/reactnative/06-advanced/03-ringing.mdx

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,50 +44,65 @@ The caller will automatically join the call once the first callee accepts the ca
4444
The call will automatically stop if every callee rejects the call.
4545

4646
:::note
47-
When ring is true, a push notification will be sent to the members, provided their app have the required setup.
47+
When ring is true, a **push notification** will be sent to the members, provided their app have the required setup.
4848
For more details around push notifications, please check [this page](../../advanced/push-notifications/overview).
4949
:::
5050

5151
## Watch for incoming and outgoing calls
5252

53-
The easiest way to watch for incoming and outgoing calls is to use the `useCalls` hook.
53+
The easiest way to watch for incoming and outgoing calls is to use the `useCalls` hook and the [`RingingCallContent`](../../ui-components/call/ringing-call-content) component.
5454

55-
```tsx
56-
import { useCalls, CallingState } from '@stream-io/video-react-native-sdk';
55+
**Important**: Make sure that the ringing calls are watched in the root component of your app. This makes sure that in whichever screen the user is in, or if the app was opened from a push notification it is shown. Below is an example of how to watch for ringing calls in the root component of your App.
5756

58-
export const MyCallUI = () => {
59-
const calls = useCalls();
57+
```ts
58+
import { SafeAreaView, StyleSheet } from 'react-native';
59+
import {
60+
StreamCall,
61+
StreamVideo,
62+
useCalls,
63+
RingingCallContent,
64+
StreamVideoClient,
65+
User,
66+
} from '@stream-io/video-react-native-sdk';
6067

61-
// handle incoming ring calls
62-
const incomingCalls = calls.filter(
63-
(call) =>
64-
call.isCreatedByMe === false &&
65-
call.state.callingState === CallingState.RINGING,
68+
const user: User = {
69+
id: 'sara',
70+
};
71+
const apiKey = '<STREAM-API-KEY>';
72+
const tokenProvider = () => Promise.resolve('<USER-TOKEN>');
73+
const client = StreamVideoClient.getOrCreateInstance({ apiKey, tokenProvider, user });
74+
75+
const RingingCalls = () => {
76+
// filter for ringing calls
77+
const calls = useCalls().filter(
78+
(c) => c.state.callingState === CallingState.RINGING,
6679
);
67-
68-
const [incomingCall] = incomingCalls;
69-
if (incomingCall) {
70-
// render the incoming call UI
71-
return <MyIncomingCallUI call={incomingCall} />;
72-
}
73-
74-
// handle outgoing ring calls
75-
const outgoingCalls = calls.filter(
76-
(call) =>
77-
call.isCreatedByMe === true &&
78-
call.state.callingState === CallingState.RINGING,
80+
const call = calls[0];
81+
if (!call) return null;
82+
83+
return (
84+
<StreamCall call={call}>
85+
<SafeAreaView style={StyleSheet.absoluteFill}>
86+
<RingingCallContent />
87+
</SafeAreaView>
88+
</StreamCall>
89+
);
90+
}
91+
92+
const App = () => {
93+
return (
94+
<StreamVideo client={client}>
95+
<MyApp />
96+
<RingingCalls />
97+
<StreamVideo>
7998
);
80-
81-
const [outgoingCall] = outgoingCalls;
82-
if (outgoingCall) {
83-
// render the outgoing call UI
84-
return <MyOutgoingCallUI call={outgoingCall} />;
85-
}
86-
87-
return null;
8899
};
100+
101+
export default App;
89102
```
90103

104+
In the above example, the component `RingingCalls` renders over the rest of the App whenever there is a incoming or outgoing call. Alternatively you can use a Modal view or Dialog to show there is a ringing call over the rest of your app.
105+
91106
## Canceling a call
92107

93108
A caller can cancel an outgoing call until the first callee accepts the call. Canceling a call will stop the signaling flow.

0 commit comments

Comments
 (0)