@stream-io/video-client 0.4.9 → 0.5.0

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 CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.5.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.4.10...@stream-io/video-client-0.5.0) (2023-11-29)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * **react-native:** move to webrtc 118 (#1197)
11
+
12
+ ### Features
13
+
14
+ * **react-native:** move to webrtc 118 ([#1197](https://github.com/GetStream/stream-video-js/issues/1197)) ([8cdbe11](https://github.com/GetStream/stream-video-js/commit/8cdbe11de069fcb6eae5643f5cef5c9612f6c805))
15
+
16
+ ### [0.4.10](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.4.9...@stream-io/video-client-0.4.10) (2023-11-27)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **session:** prevent duplication of session participants ([#1201](https://github.com/GetStream/stream-video-js/issues/1201)) ([2d0131e](https://github.com/GetStream/stream-video-js/commit/2d0131e8f97216b90d873b91282006e428e40ac0))
22
+
5
23
  ### [0.4.9](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.4.8...@stream-io/video-client-0.4.9) (2023-11-22)
6
24
 
7
25
 
@@ -5829,6 +5829,15 @@ const createSignalClient = (options) => {
5829
5829
  return new SignalServerClient(transport);
5830
5830
  };
5831
5831
 
5832
+ /**
5833
+ * Checks whether we are using React Native
5834
+ */
5835
+ const isReactNative = () => {
5836
+ if (typeof navigator === 'undefined')
5837
+ return false;
5838
+ return navigator.product?.toLowerCase() === 'reactnative';
5839
+ };
5840
+
5832
5841
  // log levels, sorted by verbosity
5833
5842
  const logLevels = Object.freeze({
5834
5843
  trace: 0,
@@ -5846,6 +5855,11 @@ const logToConsole = (logLevel, message, ...args) => {
5846
5855
  logMethod = console.error;
5847
5856
  break;
5848
5857
  case 'warn':
5858
+ if (isReactNative()) {
5859
+ message = `WARN: ${message}`;
5860
+ logMethod = console.info;
5861
+ break;
5862
+ }
5849
5863
  logMethod = console.warn;
5850
5864
  break;
5851
5865
  case 'info':
@@ -6032,15 +6046,6 @@ function getIceCandidate(candidate) {
6032
6046
  }
6033
6047
  }
6034
6048
 
6035
- /**
6036
- * Checks whether we are using React Native
6037
- */
6038
- const isReactNative = () => {
6039
- if (typeof navigator === 'undefined')
6040
- return false;
6041
- return navigator.product?.toLowerCase() === 'reactnative';
6042
- };
6043
-
6044
6049
  let sdkInfo;
6045
6050
  let osInfo;
6046
6051
  let deviceInfo;
@@ -8394,13 +8399,32 @@ class CallState {
8394
8399
  return session;
8395
8400
  }
8396
8401
  const { participants, participants_count_by_role } = session;
8397
- const { user } = event.participant;
8402
+ const { user, user_session_id } = event.participant;
8403
+ // It could happen that the backend delivers the same participant more than once.
8404
+ // Once with the call.session_started event and once again with the
8405
+ // call.session_participant_joined event. In this case,
8406
+ // we should update the existing participant and prevent duplicating it.
8407
+ let shouldInsertParticipant = true;
8408
+ const updatedParticipants = participants.map((p) => {
8409
+ if (p.user_session_id === user_session_id) {
8410
+ shouldInsertParticipant = false;
8411
+ return event.participant;
8412
+ }
8413
+ return p;
8414
+ });
8415
+ if (shouldInsertParticipant) {
8416
+ // this is a new array, we can safely push the new participant
8417
+ updatedParticipants.push(event.participant);
8418
+ }
8419
+ // If we are updating an existing participant, we don't want to increment
8420
+ // the participant_by_role count.
8421
+ const increment = shouldInsertParticipant ? 1 : 0;
8398
8422
  return {
8399
8423
  ...session,
8400
- participants: [...participants, event.participant],
8424
+ participants: updatedParticipants,
8401
8425
  participants_count_by_role: {
8402
8426
  ...participants_count_by_role,
8403
- [user.role]: (participants_count_by_role[user.role] || 0) + 1,
8427
+ [user.role]: (participants_count_by_role[user.role] || 0) + increment,
8404
8428
  },
8405
8429
  };
8406
8430
  });
@@ -14013,7 +14037,7 @@ class StreamClient {
14013
14037
  });
14014
14038
  };
14015
14039
  this.getUserAgent = () => {
14016
- const version = "0.4.9" ;
14040
+ const version = "0.5.0" ;
14017
14041
  return (this.userAgent ||
14018
14042
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14019
14043
  };
@@ -14513,6 +14537,11 @@ class StreamVideoClient {
14513
14537
  }
14514
14538
  }
14515
14539
 
14540
+ /**
14541
+ * @deprecated Please use the `@stream-io/node-sdk` package instead.
14542
+ *
14543
+ * @see https://getstream.io/video/docs/api/
14544
+ */
14516
14545
  class StreamVideoServerClient extends StreamVideoClient {
14517
14546
  constructor(apiKey, options) {
14518
14547
  super({ apiKey, options });