Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into reconnect-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlaz committed Jul 30, 2024
2 parents a49539c + d2db3ac commit 3f306b6
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 39 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.4.7](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.4.6...@stream-io/video-client-1.4.7) (2024-07-30)


### Bug Fixes

* ringing state issues when call was already ended ([#1451](https://github.com/GetStream/stream-video-js/issues/1451)) ([4a3556e](https://github.com/GetStream/stream-video-js/commit/4a3556e0f7b0bd58d0022cc635aa4391014063d7))

### [1.4.6](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.4.5...@stream-io/video-client-1.4.6) (2024-07-25)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,20 +312,30 @@ import { Call } from '@stream-io/video-client';
let call: Call;

// apply a custom video filter
const unregisterMyVideoFilter = await camera.registerFilter(
async function myVideoFilter(inputMediaStream: MediaStream) {
const { unregister: unregisterMyVideoFilter } = camera.registerFilter(
function myVideoFilter(inputMediaStream: MediaStream) {
// initialize the video filter, do some magic and
// return the modified media stream
return mediaStreamWithFilterApplied;
return {
output: mediaStreamWithFilterApplied,
stop: () => {
// optional cleanup function
},
};
},
);

// apply a custom audio filter
const unregisterMyAudioFilter = await microphone.registerFilter(
async function myAudioFilter(inputMediaStream: MediaStream) {
const { unregister: unregisterMyAudioFilter } = microphone.registerFilter(
function myAudioFilter(inputMediaStream: MediaStream) {
// initialize the audio filter, do some magic and
// return the modified media stream
return mediaStreamWithFilterApplied;
return {
output: mediaStreamWithFilterApplied,
stop: () => {
// optional cleanup function
},
};
},
);

Expand All @@ -338,6 +348,34 @@ Filters can be registered and unregistered at any time, and the SDK will take ca
Filters can be chained, and the order of registration matters.
The first registered filter will be the first to modify the raw `MediaStream`.

A filter may be asynchronous. In this case, the function passed to the `registerFilter` method should _synchronously_
return an object where `output` is a promise that resolves to a `MediaStream`:

```typescript
camera.registerFilter(function myVideoFilter(inputMediaStream: MediaStream) {
// note that output is returned synchronously!
return {
output: new Promise((resolve) => resolve(mediaStreamWithFilterApplied)),
stop: () => {
// optional cleanup function
},
};
});
```

Registering a filter is not instantaneous. If you need to know when a filter is registered (e.g. to show
a spinner in the UI), await for the `registered` promise returned by the `registerFilter` method:

```typescript
const { registered } = camera.registerFilter(
(inputMediaStream: MediaStream) => {
// your video filter
},
);
await registered;
// at this point, the filter is registered
```

Once a filter(s) is registered, the SDK will send the last returned `MediaStream` to the remote participants.

## Speaker management
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.4.6",
"version": "1.4.7",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
58 changes: 46 additions & 12 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,11 +447,43 @@ export class Call {
// "ringing" mode effects and event handlers
createSubscription(this.ringingSubject, (isRinging) => {
if (!isRinging) return;
this.scheduleAutoDrop();
if (this.state.callingState === CallingState.IDLE) {
this.state.setCallingState(CallingState.RINGING);
const callSession = this.state.session;
const receiver_id = this.clientStore.connectedUser?.id;
const endedAt = this.state.endedAt;
const created_by_id = this.state.createdBy?.id;
const rejected_by = callSession?.rejected_by;
const accepted_by = callSession?.accepted_by;
let leaveCallIdle = false;
if (endedAt) {
// call was ended before it was accepted or rejected so we should leave it to idle
leaveCallIdle = true;
} else if (created_by_id && rejected_by) {
if (rejected_by[created_by_id]) {
// call was cancelled by the caller
leaveCallIdle = true;
}
} else if (receiver_id && rejected_by) {
if (rejected_by[receiver_id]) {
// call was rejected by the receiver in some other device
leaveCallIdle = true;
}
} else if (receiver_id && accepted_by) {
if (accepted_by[receiver_id]) {
// call was accepted by the receiver in some other device
leaveCallIdle = true;
}
}
if (leaveCallIdle) {
if (this.state.callingState !== CallingState.IDLE) {
this.state.setCallingState(CallingState.IDLE);
}
} else {
this.scheduleAutoDrop();
if (this.state.callingState === CallingState.IDLE) {
this.state.setCallingState(CallingState.RINGING);
}
this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
}
this.leaveCallHooks.add(registerRingingCallEventHandlers(this));
}),
);
}
Expand Down Expand Up @@ -621,14 +653,15 @@ export class Call {
params,
);

if (params?.ring && !this.ringing) {
this.ringingSubject.next(true);
}

this.state.updateFromCallResponse(response.call);
this.state.setMembers(response.members);
this.state.setOwnCapabilities(response.own_capabilities);

if (params?.ring || this.ringing) {
// the call response can indicate where the call is still ringing or not
this.ringingSubject.next(true);
}

if (this.streamClient._hasConnectionID()) {
this.watching = true;
this.clientStore.registerCall(this);
Expand All @@ -651,14 +684,15 @@ export class Call {
GetOrCreateCallRequest
>(this.streamClientBasePath, data);

if (data?.ring && !this.ringing) {
this.ringingSubject.next(true);
}

this.state.updateFromCallResponse(response.call);
this.state.setMembers(response.members);
this.state.setOwnCapabilities(response.own_capabilities);

if (data?.ring || this.ringing) {
// the call response can indicate where the call is still ringing or not
this.ringingSubject.next(true);
}

if (this.streamClient._hasConnectionID()) {
this.watching = true;
this.clientStore.registerCall(this);
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).

### [0.4.51](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.4.50...@stream-io/video-react-bindings-0.4.51) (2024-07-30)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.4.7`
### [0.4.50](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-bindings-0.4.49...@stream-io/video-react-bindings-0.4.50) (2024-07-25)

### 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": "0.4.50",
"version": "0.4.51",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
11 changes: 11 additions & 0 deletions packages/react-native-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

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

### [0.9.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.9.4...@stream-io/video-react-native-sdk-0.9.5) (2024-07-30)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.4.7`
* `@stream-io/video-react-bindings` updated to version `0.4.51`

### Bug Fixes

* ringing state issues when call was already ended ([#1451](https://github.com/GetStream/stream-video-js/issues/1451)) ([4a3556e](https://github.com/GetStream/stream-video-js/commit/4a3556e0f7b0bd58d0022cc635aa4391014063d7))

### [0.9.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-native-sdk-0.9.3...@stream-io/video-react-native-sdk-0.9.4) (2024-07-25)

### Dependency Updates
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-native-sdk",
"version": "0.9.4",
"version": "0.9.5",
"packageManager": "[email protected]",
"main": "dist/commonjs/index.js",
"module": "dist/module/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ async function startForegroundService(call_cid: string) {
});
}

async function stopForegroundService() {
if (!isAndroid7OrBelow) return;
await notifee.stopForegroundService();
}

// flag to check if setForegroundService has already been run once
let isSetForegroundServiceRan = false;

Expand Down Expand Up @@ -90,9 +85,7 @@ export const useAndroidKeepCallAliveEffect = () => {
);
if (activeCallNotification) {
// this means that we have a incoming call notification shown as foreground service and we must stop it
if (isAndroid7OrBelow) {
notifee.stopForegroundService();
}
notifee.stopForegroundService();
notifee.cancelDisplayedNotification(activeCallCid);
}
// request for notification permission and then start the foreground service
Expand All @@ -114,7 +107,7 @@ export const useAndroidKeepCallAliveEffect = () => {
) {
if (foregroundServiceStartedRef.current) {
// stop foreground service when the call is not active
stopForegroundService();
notifee.stopForegroundService();
foregroundServiceStartedRef.current = false;
} else {
notifee.getDisplayedNotifications().then((displayedNotifications) => {
Expand All @@ -134,7 +127,7 @@ export const useAndroidKeepCallAliveEffect = () => {
return () => {
// stop foreground service when this effect is unmounted
if (foregroundServiceStartedRef.current) {
stopForegroundService();
notifee.stopForegroundService();
foregroundServiceStartedRef.current = false;
}
};
Expand Down
6 changes: 6 additions & 0 deletions packages/react-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

### [1.2.19](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.2.18...@stream-io/video-react-sdk-1.2.19) (2024-07-30)

### Dependency Updates

* `@stream-io/video-client` updated to version `1.4.7`
* `@stream-io/video-react-bindings` updated to version `0.4.51`
### [1.2.18](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.2.17...@stream-io/video-react-sdk-1.2.18) (2024-07-29)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,30 @@ const { camera } = useCameraState();
const { microphone } = useMicrophoneState();

// apply a custom video filter
const unregisterMyVideoFilter = await camera.registerFilter(
async function myVideoFilter(inputMediaStream: MediaStream) {
const { unregister: unregisterMyVideoFilter } = camera.registerFilter(
function myVideoFilter(inputMediaStream: MediaStream) {
// initialize the video filter, do some magic and
// return the modified media stream
return mediaStreamWithFilterApplied;
return {
output: mediaStreamWithFilterApplied,
stop: () => {
// optional cleanup function
},
};
},
);

// apply a custom audio filter
const unregisterMyAudioFilter = await microphone.registerFilter(
async function myAudioFilter(inputMediaStream: MediaStream) {
const { unregister: unregisterMyAudioFilter } = microphone.registerFilter(
function myAudioFilter(inputMediaStream: MediaStream) {
// initialize the audio filter, do some magic and
// return the modified media stream
return mediaStreamWithFilterApplied;
return {
output: mediaStreamWithFilterApplied,
stop: () => {
// optional cleanup function
},
};
},
);

Expand All @@ -261,6 +271,34 @@ Filters can be registered and unregistered at any time, and the SDK will take ca
Filters can be chained, and the order of registration matters.
The first registered filter will be the first to modify the raw `MediaStream`.

A filter may be asynchronous. In this case, the function passed to the `registerFilter` method should _synchronously_
return an object where `output` is a promise that resolves to a `MediaStream`:

```typescript
camera.registerFilter(function myVideoFilter(inputMediaStream: MediaStream) {
// note that output is returned synchronously!
return {
output: new Promise((resolve) => resolve(mediaStreamWithFilterApplied)),
stop: () => {
// optional cleanup function
},
};
});
```

Registering a filter is not instantaneous. If you need to know when a filter is registered (e.g. to show
a spinner in the UI), await for the `registered` promise returned by the `registerFilter` method:

```typescript
const { registered } = camera.registerFilter(
(inputMediaStream: MediaStream) => {
// your video filter
},
);
await registered;
// at this point, the filter is registered
```

Once a filter(s) is registered, the SDK will send the last returned `MediaStream` to the remote participants.

## Speaker management
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-sdk",
"version": "1.2.18",
"version": "1.2.19",
"packageManager": "[email protected]",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
Expand Down
2 changes: 1 addition & 1 deletion sample-apps/react-native/dogfood/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stream-io/video-react-native-dogfood",
"version": "4.0.4",
"version": "4.0.5",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down

0 comments on commit 3f306b6

Please sign in to comment.