@stream-io/video-client 0.0.26 → 0.0.28

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/dist/index.es.js CHANGED
@@ -6505,6 +6505,7 @@ class StreamVideoWriteableStateStore {
6505
6505
  // leave all calls when the user disconnects.
6506
6506
  if (!user) {
6507
6507
  for (const call of this.calls) {
6508
+ getLogger(['client-state'])('info', `User disconnected, leaving call: ${call.cid}`);
6508
6509
  yield call.leave();
6509
6510
  }
6510
6511
  }
@@ -8555,6 +8556,7 @@ class Call {
8555
8556
  this.join = (data) => __awaiter(this, void 0, void 0, function* () {
8556
8557
  var _e, _f;
8557
8558
  if ([CallingState.JOINED, CallingState.JOINING].includes(this.state.callingState)) {
8559
+ this.logger('warn', 'Join method called twice, you should only call this once');
8558
8560
  throw new Error(`Illegal State: Already joined.`);
8559
8561
  }
8560
8562
  if (this.state.callingState === CallingState.LEFT) {
@@ -8562,6 +8564,7 @@ class Call {
8562
8564
  }
8563
8565
  const previousCallingState = this.state.callingState;
8564
8566
  this.state.setCallingState(CallingState.JOINING);
8567
+ this.logger('debug', 'Starting join flow');
8565
8568
  if ((data === null || data === void 0 ? void 0 : data.ring) && !this.ringing) {
8566
8569
  this.ringingSubject.next(true);
8567
8570
  }
@@ -8799,6 +8802,7 @@ class Call {
8799
8802
  // otherwise we risk breaking the ICETrickle flow.
8800
8803
  yield this.assertCallJoined();
8801
8804
  if (!this.publisher) {
8805
+ this.logger('error', 'Trying to publish video before join is completed');
8802
8806
  throw new Error(`Call not joined yet.`);
8803
8807
  }
8804
8808
  const [videoTrack] = videoStream.getVideoTracks();
@@ -8823,6 +8827,7 @@ class Call {
8823
8827
  // otherwise we risk breaking the ICETrickle flow.
8824
8828
  yield this.assertCallJoined();
8825
8829
  if (!this.publisher) {
8830
+ this.logger('error', 'Trying to publish audio before join is completed');
8826
8831
  throw new Error(`Call not joined yet.`);
8827
8832
  }
8828
8833
  const [audioTrack] = audioStream.getAudioTracks();
@@ -8846,6 +8851,7 @@ class Call {
8846
8851
  // otherwise we risk breaking the ICETrickle flow.
8847
8852
  yield this.assertCallJoined();
8848
8853
  if (!this.publisher) {
8854
+ this.logger('error', 'Trying to publish screen share before join is completed');
8849
8855
  throw new Error(`Call not joined yet.`);
8850
8856
  }
8851
8857
  const [screenShareTrack] = screenShareStream.getVideoTracks();
@@ -9329,12 +9335,12 @@ class Call {
9329
9335
  return response;
9330
9336
  });
9331
9337
  /**
9332
- * Sends an event to all call participants.
9338
+ * Sends a custom event to all call participants.
9333
9339
  *
9334
9340
  * @param event the event to send.
9335
9341
  */
9336
- this.sendEvent = (event) => __awaiter(this, void 0, void 0, function* () {
9337
- return this.streamClient.post(`${this.streamClientBasePath}/event`, event);
9342
+ this.sendCustomEvent = (payload) => __awaiter(this, void 0, void 0, function* () {
9343
+ return this.streamClient.post(`${this.streamClientBasePath}/event`, { custom: payload });
9338
9344
  });
9339
9345
  this.type = type;
9340
9346
  this.id = id;
@@ -9394,6 +9400,7 @@ class Call {
9394
9400
  const currentUserId = this.currentUserId;
9395
9401
  if (currentUserId &&
9396
9402
  metadata.blocked_user_ids.includes(currentUserId)) {
9403
+ this.logger('info', 'Leaving call bacause of being blocked');
9397
9404
  yield this.leave();
9398
9405
  }
9399
9406
  })),
@@ -10942,7 +10949,6 @@ class StreamClient {
10942
10949
  if (!(key in this.listeners)) {
10943
10950
  this.listeners[key] = [];
10944
10951
  }
10945
- this.logger('info', `Attaching listener for ${key} event`);
10946
10952
  this.listeners[key].push(callback);
10947
10953
  return () => {
10948
10954
  this.off(key, callback);
@@ -11102,7 +11108,7 @@ class StreamClient {
11102
11108
  }
11103
11109
  getUserAgent() {
11104
11110
  return (this.userAgent ||
11105
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.25"}`);
11111
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.27"}`);
11106
11112
  }
11107
11113
  setUserAgent(userAgent) {
11108
11114
  this.userAgent = userAgent;
@@ -11413,6 +11419,7 @@ class StreamVideoClient {
11413
11419
  const callsToReWatch = this.writeableStateStore.calls
11414
11420
  .filter((call) => call.watching)
11415
11421
  .map((call) => call.cid);
11422
+ this.logger('info', `Rewatching calls after connection changed ${callsToReWatch.join(', ')}`);
11416
11423
  if (callsToReWatch.length > 0) {
11417
11424
  this.queryCalls({
11418
11425
  watch: true,
@@ -11434,6 +11441,7 @@ class StreamVideoClient {
11434
11441
  this.logger('warn', 'Received `call.created` sent by the current user');
11435
11442
  return;
11436
11443
  }
11444
+ this.logger('info', `New call created and registered: ${call.cid}`);
11437
11445
  this.writeableStateStore.registerCall(new Call({
11438
11446
  streamClient: this.streamClient,
11439
11447
  type: call.type,