@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.
@@ -45,7 +45,7 @@ export interface StreamVideoParticipant extends Participant {
45
45
  /**
46
46
  * True if the participant is the local participant.
47
47
  */
48
- isLoggedInUser?: boolean;
48
+ isLocalParticipant?: boolean;
49
49
  /**
50
50
  * Timestamp of when the participant is pinned
51
51
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stream-io/video-client",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "packageManager": "yarn@3.2.4",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.es.js",
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
- isLoggedInUser: participant.sessionId === sfuClient.sessionId,
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.isLoggedInUser) return;
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
- isLoggedInUser: true,
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
- isLoggedInUser: true,
62
+ isLocalParticipant: true,
63
63
  },
64
64
  ]);
65
65
  const handler = watchCallPermissionsUpdated(state);
@@ -67,7 +67,7 @@ describe('Publisher', () => {
67
67
  state.setParticipants([
68
68
  // @ts-ignore
69
69
  {
70
- isLoggedInUser: true,
70
+ isLocalParticipant: true,
71
71
  userId: 'test-user-id',
72
72
  sessionId: sessionId,
73
73
  publishedTracks: [],
@@ -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.isLoggedInUser ? 'publisher' : 'subscriber';
125
+ const kind = participant.isLocalParticipant
126
+ ? 'publisher'
127
+ : 'subscriber';
126
128
  try {
127
129
  const mergedStream = new MediaStream([
128
130
  ...(participant.videoStream?.getVideoTracks() || []),
@@ -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.isLoggedInUser)),
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
- isLoggedInUser?: boolean;
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.isLoggedInUser;
112
+ return !!p.isLocalParticipant;
113
113
  };
114
114
 
115
115
  /**