Skip to content

Commit

Permalink
Merge branch 'main' into codec-negotiation
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz committed Nov 14, 2024
2 parents cda1dcd + bcac386 commit 5acc176
Show file tree
Hide file tree
Showing 56 changed files with 1,389 additions and 860 deletions.
7 changes: 7 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

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

## [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)


### Bug Fixes

* 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))

## [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)


Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-client",
"version": "1.11.0",
"version": "1.11.1",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
30 changes: 14 additions & 16 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,20 +521,15 @@ export class Call {
await waitUntilCallJoined();
}

if (reject && this.ringing) {
// I'm the one who started the call, so I should cancel it.
const hasOtherParticipants = this.state.remoteParticipants.length > 0;
if (
this.isCreatedByMe &&
!hasOtherParticipants &&
callingState === CallingState.RINGING
) {
// Signals other users that I have cancelled my call to them
// before they accepted it.
await this.reject();
} else if (callingState === CallingState.RINGING) {
// Signals other users that I have rejected the incoming call.
await this.reject();
if (callingState === CallingState.RINGING) {
if (reject) {
await this.reject(reason);
} else {
const hasOtherParticipants = this.state.remoteParticipants.length > 0;
if (this.isCreatedByMe && !hasOtherParticipants) {
// I'm the one who started the call, so I should cancel it when there are no other participants.
await this.reject('cancel');
}
}
}

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

const timeoutInMs = settings.ring.auto_cancel_timeout_ms;
const timeoutInMs = this.isCreatedByMe
? settings.ring.auto_cancel_timeout_ms
: settings.ring.incoming_call_timeout_ms;

// 0 means no auto-drop
if (timeoutInMs <= 0) return;

clearTimeout(this.dropTimeout);
this.dropTimeout = setTimeout(() => {
this.leave({ reason: 'ring: timeout' }).catch((err) => {
this.leave({ reject: true, reason: 'timeout' }).catch((err) => {
this.logger('error', 'Failed to drop call', err);
});
}, timeoutInMs);
Expand Down
5 changes: 5 additions & 0 deletions packages/react-bindings/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

## [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)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.11.1`
## [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)

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/react-bindings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-bindings",
"version": "1.1.17",
"version": "1.1.18",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
18 changes: 18 additions & 0 deletions packages/react-native-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

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

## [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)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.11.1`
* `@stream-io/video-react-bindings` updated to version `1.1.18`

### Bug Fixes

* 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))

## [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)


### Features

* 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)

## [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)

### Dependency Updates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,21 @@ To use the `RingingCallContent` you can do the following:

```tsx {11}
import {
StreamCall,
useCalls,
RingingCallContent,
} from '@stream-io/video-react-native-sdk';

const Call = () => {
const calls = useCalls();
// filter for ringing calls
const calls = useCalls().filter(
(c) => c.state.callingState === CallingState.RINGING,
);
const call = calls[0];
if (!call) return null;

return (
<StreamCall call={call[0]}>
<StreamCall call={call}>
<RingingCallContent />
</StreamCall>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,50 +44,65 @@ The caller will automatically join the call once the first callee accepts the ca
The call will automatically stop if every callee rejects the call.

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

## Watch for incoming and outgoing calls

The easiest way to watch for incoming and outgoing calls is to use the `useCalls` hook.
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.

```tsx
import { useCalls, CallingState } from '@stream-io/video-react-native-sdk';
**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.

export const MyCallUI = () => {
const calls = useCalls();
```ts
import { SafeAreaView, StyleSheet } from 'react-native';
import {
StreamCall,
StreamVideo,
useCalls,
RingingCallContent,
StreamVideoClient,
User,
} from '@stream-io/video-react-native-sdk';

// handle incoming ring calls
const incomingCalls = calls.filter(
(call) =>
call.isCreatedByMe === false &&
call.state.callingState === CallingState.RINGING,
const user: User = {
id: 'sara',
};
const apiKey = '<STREAM-API-KEY>';
const tokenProvider = () => Promise.resolve('<USER-TOKEN>');
const client = StreamVideoClient.getOrCreateInstance({ apiKey, tokenProvider, user });

const RingingCalls = () => {
// filter for ringing calls
const calls = useCalls().filter(
(c) => c.state.callingState === CallingState.RINGING,
);

const [incomingCall] = incomingCalls;
if (incomingCall) {
// render the incoming call UI
return <MyIncomingCallUI call={incomingCall} />;
}

// handle outgoing ring calls
const outgoingCalls = calls.filter(
(call) =>
call.isCreatedByMe === true &&
call.state.callingState === CallingState.RINGING,
const call = calls[0];
if (!call) return null;

return (
<StreamCall call={call}>
<SafeAreaView style={StyleSheet.absoluteFill}>
<RingingCallContent />
</SafeAreaView>
</StreamCall>
);
}

const App = () => {
return (
<StreamVideo client={client}>
<MyApp />
<RingingCalls />
<StreamVideo>
);

const [outgoingCall] = outgoingCalls;
if (outgoingCall) {
// render the outgoing call UI
return <MyOutgoingCallUI call={outgoingCall} />;
}

return null;
};

export default App;
```

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.

## Canceling a call

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

0 comments on commit 5acc176

Please sign in to comment.