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