@stream-io/video-client 0.0.13 → 0.0.14
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 +11 -6
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +11 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +11 -6
- package/dist/index.es.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/Call.ts +8 -2
- package/src/events/__tests__/call-permissions.test.ts +2 -2
- package/src/rtc/__tests__/publisher.test.ts +1 -1
- package/src/stats/state-store-stats-reporter.ts +3 -1
- package/src/store/CallState.ts +1 -1
- package/src/types.ts +2 -2
package/dist/src/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/Call.ts
CHANGED
|
@@ -579,6 +579,12 @@ export class Call {
|
|
|
579
579
|
throw new Error(`Illegal State: Already joined.`);
|
|
580
580
|
}
|
|
581
581
|
|
|
582
|
+
if (this.state.callingState === CallingState.LEFT) {
|
|
583
|
+
throw new Error(
|
|
584
|
+
'Illegal State: Cannot join already left call. Create a new Call instance to join a call.',
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
|
|
582
588
|
const previousCallingState = this.state.callingState;
|
|
583
589
|
this.state.setCallingState(CallingState.JOINING);
|
|
584
590
|
|
|
@@ -813,7 +819,7 @@ export class Call {
|
|
|
813
819
|
this.state.setParticipants(
|
|
814
820
|
currentParticipants.map<StreamVideoParticipant>((participant) => ({
|
|
815
821
|
...participant,
|
|
816
|
-
|
|
822
|
+
isLocalParticipant: participant.sessionId === sfuClient.sessionId,
|
|
817
823
|
viewportVisibilityState: VisibilityState.UNKNOWN,
|
|
818
824
|
})),
|
|
819
825
|
);
|
|
@@ -992,7 +998,7 @@ export class Call {
|
|
|
992
998
|
const subscriptions: TrackSubscriptionDetails[] = [];
|
|
993
999
|
participants.forEach((p) => {
|
|
994
1000
|
// we don't want to subscribe to our own tracks
|
|
995
|
-
if (p.
|
|
1001
|
+
if (p.isLocalParticipant) return;
|
|
996
1002
|
|
|
997
1003
|
// NOTE: audio tracks don't have to be requested explicitly
|
|
998
1004
|
// as the SFU will implicitly subscribe us to all of them,
|
|
@@ -14,7 +14,7 @@ describe('Call Permission Events', () => {
|
|
|
14
14
|
// @ts-expect-error
|
|
15
15
|
state.updateOrAddParticipant('session-id', {
|
|
16
16
|
userId: 'test',
|
|
17
|
-
|
|
17
|
+
isLocalParticipant: true,
|
|
18
18
|
});
|
|
19
19
|
const handler = watchCallPermissionRequest(state);
|
|
20
20
|
handler({
|
|
@@ -59,7 +59,7 @@ describe('Call Permission Events', () => {
|
|
|
59
59
|
connectionQuality: ConnectionQuality.EXCELLENT,
|
|
60
60
|
roles: [],
|
|
61
61
|
trackLookupPrefix: '',
|
|
62
|
-
|
|
62
|
+
isLocalParticipant: true,
|
|
63
63
|
},
|
|
64
64
|
]);
|
|
65
65
|
const handler = watchCallPermissionsUpdated(state);
|
|
@@ -122,7 +122,9 @@ export const createStatsReporter = ({
|
|
|
122
122
|
if (sessionIds.size > 0) {
|
|
123
123
|
for (let participant of state.participants) {
|
|
124
124
|
if (!sessionIds.has(participant.sessionId)) continue;
|
|
125
|
-
const kind = participant.
|
|
125
|
+
const kind = participant.isLocalParticipant
|
|
126
|
+
? 'publisher'
|
|
127
|
+
: 'subscriber';
|
|
126
128
|
try {
|
|
127
129
|
const mergedStream = new MediaStream([
|
|
128
130
|
...(participant.videoStream?.getVideoTracks() || []),
|
package/src/store/CallState.ts
CHANGED
|
@@ -289,7 +289,7 @@ export class CallState {
|
|
|
289
289
|
);
|
|
290
290
|
|
|
291
291
|
this.remoteParticipants$ = this.participants$.pipe(
|
|
292
|
-
map((participants) => participants.filter((p) => !p.
|
|
292
|
+
map((participants) => participants.filter((p) => !p.isLocalParticipant)),
|
|
293
293
|
);
|
|
294
294
|
|
|
295
295
|
this.pinnedParticipants$ = this.participants$.pipe(
|
package/src/types.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface StreamVideoParticipant extends Participant {
|
|
|
66
66
|
/**
|
|
67
67
|
* True if the participant is the local participant.
|
|
68
68
|
*/
|
|
69
|
-
|
|
69
|
+
isLocalParticipant?: boolean;
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Timestamp of when the participant is pinned
|
|
@@ -109,7 +109,7 @@ export interface StreamVideoLocalParticipant extends StreamVideoParticipant {
|
|
|
109
109
|
export const isStreamVideoLocalParticipant = (
|
|
110
110
|
p: StreamVideoParticipant | StreamVideoLocalParticipant,
|
|
111
111
|
): p is StreamVideoLocalParticipant => {
|
|
112
|
-
return !!p.
|
|
112
|
+
return !!p.isLocalParticipant;
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
/**
|