Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into vp9-publish
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/client/src/devices/CameraManager.ts
#	packages/client/src/rtc/Publisher.ts
#	packages/client/src/rtc/videoLayers.ts
#	packages/client/src/types.ts
#	sample-apps/react/react-dogfood/components/MeetingUI.tsx
  • Loading branch information
oliverlaz committed Oct 1, 2024
2 parents 86aacd7 + d33f188 commit 7436760
Show file tree
Hide file tree
Showing 96 changed files with 3,644 additions and 8,788 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"nx": "16.10.0",
"prettier": "^3.3.2",
"typescript": "^5.5.2",
"vercel": "^37.2.1",
"vite": "^4.4.11"
"vercel": "^37.4.2",
"vite": "^5.4.6"
},
"resolutions": {
"eslint-plugin-prettier": "^5.1.3"
Expand Down
7 changes: 7 additions & 0 deletions packages/audio-filters-web/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).

## [0.2.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/audio-filters-web-0.2.1...@stream-io/audio-filters-web-0.2.2) (2024-09-19)


### Features

* React SDK cold-start optimizations ([#1488](https://github.com/GetStream/stream-video-js/issues/1488)) ([972e579](https://github.com/GetStream/stream-video-js/commit/972e5792b5a131a212b1031ade76dcb383897a46))

### [0.2.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/audio-filters-web-0.2.0...@stream-io/audio-filters-web-0.2.1) (2024-07-02)


Expand Down
7 changes: 4 additions & 3 deletions packages/audio-filters-web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@stream-io/audio-filters-web",
"packageManager": "[email protected]",
"version": "0.2.1",
"version": "0.2.2",
"main": "./dist/index.cjs.js",
"module": "./dist/index.es.js",
"types": "./dist/index.d.ts",
Expand All @@ -16,6 +16,7 @@
"url": "https://github.com/GetStream/stream-video-js.git",
"directory": "packages/audio-filters-web"
},
"sideEffects": false,
"files": [
"dist",
"src",
Expand All @@ -29,10 +30,10 @@
"wasm-feature-detect": "^1.6.1"
},
"devDependencies": {
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-typescript": "^11.1.6",
"rimraf": "^5.0.7",
"rollup": "^3.29.4",
"rollup": "^4.22.0",
"typescript": "^5.5.2"
}
}
63 changes: 63 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,69 @@

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

## [1.7.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.7.2...@stream-io/video-client-1.7.3) (2024-09-24)


### Bug Fixes

* do not always error out api calls when web socket initially failed ([#1495](https://github.com/GetStream/stream-video-js/issues/1495)) ([7cdb62e](https://github.com/GetStream/stream-video-js/commit/7cdb62e75cad56098ee81eabbcc63382f93fd218))

## [1.7.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.7.1...@stream-io/video-client-1.7.2) (2024-09-20)


### Bug Fixes

* overridable bitrate and bitrate downscale factor ([#1493](https://github.com/GetStream/stream-video-js/issues/1493)) ([cce5d8e](https://github.com/GetStream/stream-video-js/commit/cce5d8e641a9182a1779952e4e62aa16ec21ab92))

## [1.7.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.7.0...@stream-io/video-client-1.7.1) (2024-09-20)


### Bug Fixes

* don't attempt to recover broken WebSockets when there isn't a network connection ([#1490](https://github.com/GetStream/stream-video-js/issues/1490)) ([d576f48](https://github.com/GetStream/stream-video-js/commit/d576f48c7f819d48008359a3c30fe5d1a3372145))

## [1.7.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.5...@stream-io/video-client-1.7.0) (2024-09-19)


### Features

* React SDK cold-start optimizations ([#1488](https://github.com/GetStream/stream-video-js/issues/1488)) ([972e579](https://github.com/GetStream/stream-video-js/commit/972e5792b5a131a212b1031ade76dcb383897a46))

## [1.6.5](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.4...@stream-io/video-client-1.6.5) (2024-09-19)


### Bug Fixes

* race condition in `applySettingsToStream` ([#1489](https://github.com/GetStream/stream-video-js/issues/1489)) ([bf2ad90](https://github.com/GetStream/stream-video-js/commit/bf2ad90224d88592d4ea27ea8d0683efe98771f7))

## [1.6.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.3...@stream-io/video-client-1.6.4) (2024-09-13)


### Bug Fixes

* allow video target bitrate override ([#1487](https://github.com/GetStream/stream-video-js/issues/1487)) ([bfe34a3](https://github.com/GetStream/stream-video-js/commit/bfe34a3609182da5bbb03331978d86569cada098))

## [1.6.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.2...@stream-io/video-client-1.6.3) (2024-09-11)


### Bug Fixes

* client instance removal used a wrong key ([#1484](https://github.com/GetStream/stream-video-js/issues/1484)) ([edff5d7](https://github.com/GetStream/stream-video-js/commit/edff5d7ca0cc241a3929da3b752073883f29da32))

## [1.6.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.1...@stream-io/video-client-1.6.2) (2024-09-09)


### Bug Fixes

* prioritize h264 baseline profile ([#1482](https://github.com/GetStream/stream-video-js/issues/1482)) ([3ea3c5e](https://github.com/GetStream/stream-video-js/commit/3ea3c5ecf57b50d3f909d59a96811f636b07d8aa))

## [1.6.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.6.0...@stream-io/video-client-1.6.1) (2024-09-05)


### Bug Fixes

* update state.endedAt after the SFU terminates the call ([#1477](https://github.com/GetStream/stream-video-js/issues/1477)) ([135b11f](https://github.com/GetStream/stream-video-js/commit/135b11f2e29f486f2f43b9ac2a84848d0fd0b5b4))

## [1.6.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.5.2...@stream-io/video-client-1.6.0) (2024-09-03)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ npm install @stream-io/audio-filters-web

## Integration

In the following code snippet, we show how to check if platform is supported, initialize the plugin and enable/disable it.
In the following code snippet, we show how to check if а platform is supported, initialize the plugin, and enable/disable it.

```typescript
import { NoiseCancellation } from '@stream-io/audio-filters-web';
Expand Down Expand Up @@ -61,3 +61,19 @@ const off = noiseCancellation.on('change', (v) => {
console.log(`Noise Cancellation is ${v ? 'enabled' : 'disabled'}`);
});
```

In action, the most straight-forward integration should look like this:

```typescript
import { NoiseCancellation } from '@stream-io/audio-filters-web';

const call = client.call(type, id);
await call.get(); // or call.getOrCreate()

const noiseCancellation = new NoiseCancellation();
const isSupported = await noiseCancellation.isSupported();
if (isSupported) {
await noiseCancellation.init();
await call.microphone.enableNoiseCancellation(noiseCancellation);
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const { calls } = await client.queryCalls({
});
```

### Calls that live / currently have participants
### Calls that are ongoing / currently have participants

```typescript
import { StreamVideoClient } from '@stream-io/video-client';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
id: querying-call-members
title: Querying Call Members
description: How to query call members
---

import FilterConditions from '../../../shared/_filter-operators.mdx';
import CallMemberFilters from '../../../shared/video/_call-member-filters.mdx';
import CallMemberSort from '../../../shared/video/_call-member-sort-fields.mdx';

When you create or join a call you get a list of call members, however this can return at most 100 members:

```typescript
// The maximum limit is 100
// The default limit is 25
await call.getOrCreate({ members_limit: 100 });

// or
await call.join({ members_limit: 100 });
```

To get the complete list of call members the Stream API allows you to query, filter and sort members of a call using a paginated list.

## Examples

Below are a few examples of how to use this API:

```typescript
const result = await call.queryMembers();

// sorting and pagination
const queryMembersReq = {
sort: [{ field: 'user_id', direction: 1 }],
limit: 2,
};
const result = await call.queryMembers(queryMembersReq);

// loading the next page
const result = await call.queryMembers({
...queryMembersReq,
next: result.next,
});

// filtering
const result = await call.queryMembers({
filter_conditions: { role: { $eq: 'admin' } },
});
```

## Sort options

<CallMemberSort />

## Filter options

<CallMemberFilters />

<FilterConditions />
10 changes: 5 additions & 5 deletions 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.6.0",
"version": "1.7.3",
"packageManager": "[email protected]",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down Expand Up @@ -43,20 +43,20 @@
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "^2.13.4",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-replace": "^5.0.7",
"@rollup/plugin-typescript": "^11.1.6",
"@stream-io/audio-filters-web": "workspace:^",
"@stream-io/node-sdk": "^0.4.0",
"@stream-io/node-sdk": "^0.4.3",
"@types/sdp-transform": "^2.4.7",
"@types/ua-parser-js": "^0.7.37",
"@vitest/coverage-v8": "^0.34.4",
"dotenv": "^16.3.1",
"happy-dom": "^11.0.2",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"rollup": "^3.29.4",
"rollup": "^4.22.0",
"typescript": "^5.5.2",
"vite": "^4.4.11",
"vite": "^5.4.6",
"vitest": "^1.0.0",
"vitest-mock-extended": "^1.2.1"
}
Expand Down
15 changes: 9 additions & 6 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ export class Call {
logTag: String(this.sfuClientTag++),
dispatcher: this.dispatcher,
credentials: this.credentials,
streamClient: this.streamClient,
// a new session_id is necessary for the REJOIN strategy.
// we use the previous session_id if available
sessionId: performingRejoin ? undefined : previousSessionId,
Expand Down Expand Up @@ -1324,9 +1325,10 @@ export class Call {
case TrackType.VIDEO:
const videoStream = this.camera.state.mediaStream;
if (videoStream) {
await this.publishVideoStream(videoStream, {
preferredCodec: this.camera.preferredCodec,
});
await this.publishVideoStream(
videoStream,
this.camera.publishOptions,
);
}
break;
case TrackType.SCREEN_SHARE:
Expand Down Expand Up @@ -2209,9 +2211,10 @@ export class Call {
this.camera.state.mediaStream &&
!this.publisher?.isPublishing(TrackType.VIDEO)
) {
await this.publishVideoStream(this.camera.state.mediaStream, {
preferredCodec: this.camera.preferredCodec,
});
await this.publishVideoStream(
this.camera.state.mediaStream,
this.camera.publishOptions,
);
}

// Start camera if backend config specifies, and there is no local setting
Expand Down
21 changes: 21 additions & 0 deletions packages/client/src/StreamSfuClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
UpdateMuteStatesRequest,
} from './gen/video/sfu/signal_rpc/signal';
import { ICETrickle, TrackType } from './gen/video/sfu/models/models';
import { StreamClient } from './coordinator/connection/client';
import { generateUUIDv4, sleep } from './coordinator/connection/utils';
import { Credentials } from './gen/coordinator';
import { Logger } from './coordinator/connection/types';
Expand Down Expand Up @@ -65,6 +66,11 @@ export type StreamSfuClientConstructor = {
* Callback for when the WebSocket connection is closed.
*/
onSignalClose?: () => void;

/**
* The StreamClient instance to use for the connection.
*/
streamClient: StreamClient;
};

/**
Expand Down Expand Up @@ -112,12 +118,14 @@ export class StreamSfuClient {
private lastMessageTimestamp?: Date;
private readonly restoreWebSocketConcurrencyTag = Symbol('recoverWebSocket');
private readonly unsubscribeIceTrickle: () => void;
private readonly unsubscribeNetworkChanged: () => void;
private readonly onSignalClose: (() => void) | undefined;
private readonly logger: Logger;
private readonly logTag: string;
private readonly credentials: Credentials;
private readonly dispatcher: Dispatcher;
private readonly joinResponseTimeout?: number;
private networkAvailableTask: PromiseWithResolvers<void> | undefined;
/**
* Promise that resolves when the JoinResponse is received.
* Rejects after a certain threshold if the response is not received.
Expand Down Expand Up @@ -163,6 +171,7 @@ export class StreamSfuClient {
logTag,
joinResponseTimeout = 5000,
onSignalClose,
streamClient,
}: StreamSfuClientConstructor) {
this.dispatcher = dispatcher;
this.sessionId = sessionId || generateUUIDv4();
Expand Down Expand Up @@ -193,6 +202,16 @@ export class StreamSfuClient {
this.iceTrickleBuffer.push(iceTrickle);
});

// listen to network changes to handle offline state
// we shouldn't attempt to recover websocket connection when offline
this.unsubscribeNetworkChanged = streamClient.on('network.changed', (e) => {
if (!e.online) {
this.networkAvailableTask = promiseWithResolvers();
} else {
this.networkAvailableTask?.resolve();
}
});

this.createWebSocket();
}

Expand Down Expand Up @@ -226,6 +245,7 @@ export class StreamSfuClient {

private restoreWebSocket = () => {
withoutConcurrency(this.restoreWebSocketConcurrencyTag, async () => {
await this.networkAvailableTask?.promise;
this.logger('debug', 'Restoring SFU WS connection');
this.cleanUpWebSocket();
await sleep(500);
Expand Down Expand Up @@ -260,6 +280,7 @@ export class StreamSfuClient {
dispose = () => {
this.logger('debug', 'Disposing SFU client');
this.unsubscribeIceTrickle();
this.unsubscribeNetworkChanged();
clearInterval(this.keepAliveInterval);
clearTimeout(this.connectionCheckTimeout);
clearTimeout(this.migrateAwayTimeout);
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/StreamVideoClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export class StreamVideoClient {
return;
}
const userId = this.streamClient.user?.id;
const apiKey = this.streamClient.key;
const disconnectUser = () => this.streamClient.disconnectUser(timeout);
this.disconnectionPromise = this.connectionPromise
? this.connectionPromise.then(() => disconnectUser())
Expand All @@ -329,7 +330,7 @@ export class StreamVideoClient {
);
await this.disconnectionPromise;
if (userId) {
StreamVideoClient._instanceMap.delete(userId);
StreamVideoClient._instanceMap.delete(apiKey + userId);
}
this.eventHandlersToUnregister.forEach((unregister) => unregister());
this.eventHandlersToUnregister = [];
Expand Down
Loading

0 comments on commit 7436760

Please sign in to comment.