@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 +18 -0
- package/dist/index.browser.es.js +42 -13
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +42 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +42 -13
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamVideoServerClient.d.ts +5 -0
- package/package.json +1 -1
- package/src/StreamVideoServerClient.ts +5 -0
- package/src/logger.ts +6 -0
- package/src/store/CallState.ts +23 -3
- package/src/store/__tests__/CallState.test.ts +50 -0
package/dist/index.cjs.js
CHANGED
|
@@ -5852,6 +5852,15 @@ const createSignalClient = (options) => {
|
|
|
5852
5852
|
return new SignalServerClient(transport);
|
|
5853
5853
|
};
|
|
5854
5854
|
|
|
5855
|
+
/**
|
|
5856
|
+
* Checks whether we are using React Native
|
|
5857
|
+
*/
|
|
5858
|
+
const isReactNative = () => {
|
|
5859
|
+
if (typeof navigator === 'undefined')
|
|
5860
|
+
return false;
|
|
5861
|
+
return navigator.product?.toLowerCase() === 'reactnative';
|
|
5862
|
+
};
|
|
5863
|
+
|
|
5855
5864
|
// log levels, sorted by verbosity
|
|
5856
5865
|
const logLevels = Object.freeze({
|
|
5857
5866
|
trace: 0,
|
|
@@ -5869,6 +5878,11 @@ const logToConsole = (logLevel, message, ...args) => {
|
|
|
5869
5878
|
logMethod = console.error;
|
|
5870
5879
|
break;
|
|
5871
5880
|
case 'warn':
|
|
5881
|
+
if (isReactNative()) {
|
|
5882
|
+
message = `WARN: ${message}`;
|
|
5883
|
+
logMethod = console.info;
|
|
5884
|
+
break;
|
|
5885
|
+
}
|
|
5872
5886
|
logMethod = console.warn;
|
|
5873
5887
|
break;
|
|
5874
5888
|
case 'info':
|
|
@@ -6055,15 +6069,6 @@ function getIceCandidate(candidate) {
|
|
|
6055
6069
|
}
|
|
6056
6070
|
}
|
|
6057
6071
|
|
|
6058
|
-
/**
|
|
6059
|
-
* Checks whether we are using React Native
|
|
6060
|
-
*/
|
|
6061
|
-
const isReactNative = () => {
|
|
6062
|
-
if (typeof navigator === 'undefined')
|
|
6063
|
-
return false;
|
|
6064
|
-
return navigator.product?.toLowerCase() === 'reactnative';
|
|
6065
|
-
};
|
|
6066
|
-
|
|
6067
6072
|
let sdkInfo;
|
|
6068
6073
|
let osInfo;
|
|
6069
6074
|
let deviceInfo;
|
|
@@ -8417,13 +8422,32 @@ class CallState {
|
|
|
8417
8422
|
return session;
|
|
8418
8423
|
}
|
|
8419
8424
|
const { participants, participants_count_by_role } = session;
|
|
8420
|
-
const { user } = event.participant;
|
|
8425
|
+
const { user, user_session_id } = event.participant;
|
|
8426
|
+
// It could happen that the backend delivers the same participant more than once.
|
|
8427
|
+
// Once with the call.session_started event and once again with the
|
|
8428
|
+
// call.session_participant_joined event. In this case,
|
|
8429
|
+
// we should update the existing participant and prevent duplicating it.
|
|
8430
|
+
let shouldInsertParticipant = true;
|
|
8431
|
+
const updatedParticipants = participants.map((p) => {
|
|
8432
|
+
if (p.user_session_id === user_session_id) {
|
|
8433
|
+
shouldInsertParticipant = false;
|
|
8434
|
+
return event.participant;
|
|
8435
|
+
}
|
|
8436
|
+
return p;
|
|
8437
|
+
});
|
|
8438
|
+
if (shouldInsertParticipant) {
|
|
8439
|
+
// this is a new array, we can safely push the new participant
|
|
8440
|
+
updatedParticipants.push(event.participant);
|
|
8441
|
+
}
|
|
8442
|
+
// If we are updating an existing participant, we don't want to increment
|
|
8443
|
+
// the participant_by_role count.
|
|
8444
|
+
const increment = shouldInsertParticipant ? 1 : 0;
|
|
8421
8445
|
return {
|
|
8422
8446
|
...session,
|
|
8423
|
-
participants:
|
|
8447
|
+
participants: updatedParticipants,
|
|
8424
8448
|
participants_count_by_role: {
|
|
8425
8449
|
...participants_count_by_role,
|
|
8426
|
-
[user.role]: (participants_count_by_role[user.role] || 0) +
|
|
8450
|
+
[user.role]: (participants_count_by_role[user.role] || 0) + increment,
|
|
8427
8451
|
},
|
|
8428
8452
|
};
|
|
8429
8453
|
});
|
|
@@ -14037,7 +14061,7 @@ class StreamClient {
|
|
|
14037
14061
|
});
|
|
14038
14062
|
};
|
|
14039
14063
|
this.getUserAgent = () => {
|
|
14040
|
-
const version = "0.
|
|
14064
|
+
const version = "0.5.0" ;
|
|
14041
14065
|
return (this.userAgent ||
|
|
14042
14066
|
`stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
|
|
14043
14067
|
};
|
|
@@ -14537,6 +14561,11 @@ class StreamVideoClient {
|
|
|
14537
14561
|
}
|
|
14538
14562
|
}
|
|
14539
14563
|
|
|
14564
|
+
/**
|
|
14565
|
+
* @deprecated Please use the `@stream-io/node-sdk` package instead.
|
|
14566
|
+
*
|
|
14567
|
+
* @see https://getstream.io/video/docs/api/
|
|
14568
|
+
*/
|
|
14540
14569
|
class StreamVideoServerClient extends StreamVideoClient {
|
|
14541
14570
|
constructor(apiKey, options) {
|
|
14542
14571
|
super({ apiKey, options });
|