@stream-io/video-client 0.7.9 → 0.7.10
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 +7 -0
- package/dist/index.browser.es.js +52 -29
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +52 -29
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +52 -29
- package/dist/index.es.js.map +1 -1
- package/dist/src/store/CallState.d.ts +1 -2
- package/package.json +1 -1
- package/src/store/CallState.ts +50 -30
- package/src/store/__tests__/CallState.test.ts +201 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
### [0.7.10](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.9...@stream-io/video-client-0.7.10) (2024-04-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **state:** optimized Call State updates ([#1330](https://github.com/GetStream/stream-video-js/issues/1330)) ([e5f9f88](https://github.com/GetStream/stream-video-js/commit/e5f9f882df95761bfecbd6b38832f013b0e7a75e))
|
|
11
|
+
|
|
5
12
|
### [0.7.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.7.8...@stream-io/video-client-0.7.9) (2024-04-26)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.browser.es.js
CHANGED
|
@@ -6843,6 +6843,7 @@ class CallState {
|
|
|
6843
6843
|
this.anonymousParticipantCountSubject = new BehaviorSubject(0);
|
|
6844
6844
|
this.participantsSubject = new BehaviorSubject([]);
|
|
6845
6845
|
this.callStatsReportSubject = new BehaviorSubject(undefined);
|
|
6846
|
+
this.logger = getLogger(['CallState']);
|
|
6846
6847
|
/**
|
|
6847
6848
|
* A list of comparators that are used to sort the participants.
|
|
6848
6849
|
*
|
|
@@ -7003,21 +7004,22 @@ class CallState {
|
|
|
7003
7004
|
* @param participant the participant to update or add.
|
|
7004
7005
|
*/
|
|
7005
7006
|
this.updateOrAddParticipant = (sessionId, participant) => {
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7007
|
+
return this.setParticipants((participants) => {
|
|
7008
|
+
let add = true;
|
|
7009
|
+
const nextParticipants = participants.map((p) => {
|
|
7010
|
+
if (p.sessionId === sessionId) {
|
|
7011
|
+
add = false;
|
|
7012
|
+
return {
|
|
7013
|
+
...p,
|
|
7014
|
+
...participant,
|
|
7015
|
+
};
|
|
7016
|
+
}
|
|
7017
|
+
return p;
|
|
7018
|
+
});
|
|
7019
|
+
if (add)
|
|
7020
|
+
nextParticipants.push(participant);
|
|
7021
|
+
return nextParticipants;
|
|
7022
|
+
});
|
|
7021
7023
|
};
|
|
7022
7024
|
/**
|
|
7023
7025
|
* Updates all participants in the current call whose session ID is in the given `sessionIds`.
|
|
@@ -7242,7 +7244,6 @@ class CallState {
|
|
|
7242
7244
|
this.setCurrentValue(this.ownCapabilitiesSubject, event.own_capabilities);
|
|
7243
7245
|
}
|
|
7244
7246
|
};
|
|
7245
|
-
this.logger = getLogger(['CallState']);
|
|
7246
7247
|
this.participants$ = this.participantsSubject.asObservable().pipe(
|
|
7247
7248
|
// maintain stable-sort by mutating the participants stored
|
|
7248
7249
|
// in the original subject
|
|
@@ -7252,30 +7253,52 @@ class CallState {
|
|
|
7252
7253
|
this.pinnedParticipants$ = this.participants$.pipe(map$1((participants) => participants.filter((p) => !!p.pin)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
7253
7254
|
this.dominantSpeaker$ = this.participants$.pipe(map$1((participants) => participants.find((p) => p.isDominantSpeaker)), shareReplay({ bufferSize: 1, refCount: true }));
|
|
7254
7255
|
this.hasOngoingScreenShare$ = this.participants$.pipe(map$1((participants) => participants.some((p) => p.publishedTracks.includes(TrackType.SCREEN_SHARE))), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
|
|
7255
|
-
|
|
7256
|
-
this.participantCount$ = this.participantCountSubject.asObservable();
|
|
7257
|
-
this.anonymousParticipantCount$ =
|
|
7258
|
-
this.anonymousParticipantCountSubject.asObservable();
|
|
7259
|
-
this.callStatsReport$ = this.callStatsReportSubject.asObservable();
|
|
7260
|
-
this.members$ = this.membersSubject.asObservable();
|
|
7261
|
-
this.ownCapabilities$ = this.ownCapabilitiesSubject.asObservable();
|
|
7262
|
-
this.callingState$ = this.callingStateSubject.asObservable();
|
|
7263
|
-
this.backstage$ = this.backstageSubject.asObservable();
|
|
7264
|
-
this.blockedUserIds$ = this.blockedUserIdsSubject.asObservable();
|
|
7256
|
+
// dates
|
|
7265
7257
|
this.createdAt$ = this.createdAtSubject.asObservable();
|
|
7266
7258
|
this.endedAt$ = this.endedAtSubject.asObservable();
|
|
7267
7259
|
this.startsAt$ = this.startsAtSubject.asObservable();
|
|
7260
|
+
this.startedAt$ = this.startedAtSubject.asObservable();
|
|
7268
7261
|
this.updatedAt$ = this.updatedAtSubject.asObservable();
|
|
7262
|
+
this.callStatsReport$ = this.callStatsReportSubject.asObservable();
|
|
7263
|
+
this.members$ = this.membersSubject.asObservable();
|
|
7264
|
+
// complex objects should work as streams of data
|
|
7269
7265
|
this.createdBy$ = this.createdBySubject.asObservable();
|
|
7270
7266
|
this.custom$ = this.customSubject.asObservable();
|
|
7271
7267
|
this.egress$ = this.egressSubject.asObservable();
|
|
7272
7268
|
this.ingress$ = this.ingressSubject.asObservable();
|
|
7273
|
-
this.recording$ = this.recordingSubject.asObservable();
|
|
7274
7269
|
this.session$ = this.sessionSubject.asObservable();
|
|
7275
7270
|
this.settings$ = this.settingsSubject.asObservable();
|
|
7276
|
-
this.transcribing$ = this.transcribingSubject.asObservable();
|
|
7277
7271
|
this.endedBy$ = this.endedBySubject.asObservable();
|
|
7278
7272
|
this.thumbnails$ = this.thumbnailsSubject.asObservable();
|
|
7273
|
+
/**
|
|
7274
|
+
* Performs shallow comparison of two arrays.
|
|
7275
|
+
* Expects primitive values: [1, 2, 3] is equal to [2, 1, 3].
|
|
7276
|
+
*/
|
|
7277
|
+
const isShallowEqual = (a, b) => {
|
|
7278
|
+
if (a.length !== b.length)
|
|
7279
|
+
return false;
|
|
7280
|
+
for (const item of a)
|
|
7281
|
+
if (!b.includes(item))
|
|
7282
|
+
return false;
|
|
7283
|
+
for (const item of b)
|
|
7284
|
+
if (!a.includes(item))
|
|
7285
|
+
return false;
|
|
7286
|
+
return true;
|
|
7287
|
+
};
|
|
7288
|
+
/**
|
|
7289
|
+
* Creates an Observable from the given subject by piping to the
|
|
7290
|
+
* `distinctUntilChanged()` operator.
|
|
7291
|
+
*/
|
|
7292
|
+
const duc = (subject, comparator) => subject.asObservable().pipe(distinctUntilChanged(comparator));
|
|
7293
|
+
// primitive values should only emit once the value they hold changes
|
|
7294
|
+
this.anonymousParticipantCount$ = duc(this.anonymousParticipantCountSubject);
|
|
7295
|
+
this.blockedUserIds$ = duc(this.blockedUserIdsSubject, isShallowEqual);
|
|
7296
|
+
this.backstage$ = duc(this.backstageSubject);
|
|
7297
|
+
this.callingState$ = duc(this.callingStateSubject);
|
|
7298
|
+
this.ownCapabilities$ = duc(this.ownCapabilitiesSubject, isShallowEqual);
|
|
7299
|
+
this.participantCount$ = duc(this.participantCountSubject);
|
|
7300
|
+
this.recording$ = duc(this.recordingSubject);
|
|
7301
|
+
this.transcribing$ = duc(this.transcribingSubject);
|
|
7279
7302
|
this.eventHandlers = {
|
|
7280
7303
|
// these events are not updating the call state:
|
|
7281
7304
|
'call.closed_caption': undefined,
|
|
@@ -14842,7 +14865,7 @@ class StreamClient {
|
|
|
14842
14865
|
});
|
|
14843
14866
|
};
|
|
14844
14867
|
this.getUserAgent = () => {
|
|
14845
|
-
const version = "0.7.
|
|
14868
|
+
const version = "0.7.10" ;
|
|
14846
14869
|
return (this.userAgent ||
|
|
14847
14870
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
14848
14871
|
};
|