@stream-io/video-client 1.55.0 → 1.55.2
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 +13 -0
- package/dist/index.browser.es.js +41 -9
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +41 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +41 -9
- package/dist/index.es.js.map +1 -1
- package/dist/src/Call.d.ts +4 -0
- package/dist/src/coordinator/connection/connection.d.ts +1 -0
- package/dist/src/rtc/types.d.ts +1 -0
- package/dist/src/store/CallState.d.ts +4 -0
- package/package.json +2 -2
- package/src/Call.ts +7 -0
- package/src/coordinator/connection/__tests__/connection.test.ts +47 -0
- package/src/coordinator/connection/connection.ts +20 -8
- package/src/rtc/Publisher.ts +7 -0
- package/src/rtc/__tests__/Publisher.test.ts +74 -0
- package/src/rtc/types.ts +1 -0
- package/src/store/CallState.ts +7 -0
package/dist/index.cjs.js
CHANGED
|
@@ -4946,7 +4946,7 @@ const toIceCandidate = (iceTrickle) => {
|
|
|
4946
4946
|
}
|
|
4947
4947
|
};
|
|
4948
4948
|
|
|
4949
|
-
const version = "1.55.
|
|
4949
|
+
const version = "1.55.2";
|
|
4950
4950
|
const [major, minor, patch] = version.split('.');
|
|
4951
4951
|
let sdkInfo = {
|
|
4952
4952
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -6301,6 +6301,12 @@ class CallState {
|
|
|
6301
6301
|
// trigger re-sorting of participants
|
|
6302
6302
|
this.setCurrentValue(this.participantsSubject, (ps) => ps);
|
|
6303
6303
|
};
|
|
6304
|
+
/**
|
|
6305
|
+
* Returns the comparator currently used to sort the participants.
|
|
6306
|
+
*/
|
|
6307
|
+
getSortParticipantsBy = () => {
|
|
6308
|
+
return this.sortParticipantsBy;
|
|
6309
|
+
};
|
|
6304
6310
|
/**
|
|
6305
6311
|
* Gets the current value of an observable, or undefined if the observable has
|
|
6306
6312
|
* not emitted a value yet.
|
|
@@ -9061,6 +9067,9 @@ class Publisher extends BasePeerConnection {
|
|
|
9061
9067
|
if (isAudioTrackType(trackType)) {
|
|
9062
9068
|
await this.updateAudioPublishOptions(trackType, options);
|
|
9063
9069
|
}
|
|
9070
|
+
if (track && !bundle.negotiated) {
|
|
9071
|
+
await this.negotiate();
|
|
9072
|
+
}
|
|
9064
9073
|
};
|
|
9065
9074
|
/**
|
|
9066
9075
|
* Updates the publish options for the given track type.
|
|
@@ -9317,6 +9326,10 @@ class Publisher extends BasePeerConnection {
|
|
|
9317
9326
|
throw new NegotiationError(response.error);
|
|
9318
9327
|
const { sdp: answerSdp } = response;
|
|
9319
9328
|
await this.pc.setRemoteDescription({ type: 'answer', sdp: answerSdp });
|
|
9329
|
+
for (const bundle of this.transceiverCache.items()) {
|
|
9330
|
+
if (bundle.transceiver.sender.track)
|
|
9331
|
+
bundle.negotiated = true;
|
|
9332
|
+
}
|
|
9320
9333
|
}
|
|
9321
9334
|
catch (err) {
|
|
9322
9335
|
// negotiation failed, rollback to the previous state
|
|
@@ -16362,6 +16375,12 @@ class Call {
|
|
|
16362
16375
|
setSortParticipantsBy = (criteria) => {
|
|
16363
16376
|
return this.state.setSortParticipantsBy(criteria);
|
|
16364
16377
|
};
|
|
16378
|
+
/**
|
|
16379
|
+
* Returns the comparator currently used to sort the participants.
|
|
16380
|
+
*/
|
|
16381
|
+
getSortParticipantsBy = () => {
|
|
16382
|
+
return this.state.getSortParticipantsBy();
|
|
16383
|
+
};
|
|
16365
16384
|
/**
|
|
16366
16385
|
* Sends a reaction to the other call participants.
|
|
16367
16386
|
*
|
|
@@ -17211,6 +17230,7 @@ class StableWSConnection {
|
|
|
17211
17230
|
consecutiveFailures = 0;
|
|
17212
17231
|
/** keep track of the total number of failures */
|
|
17213
17232
|
totalFailures = 0;
|
|
17233
|
+
lastConnectionError;
|
|
17214
17234
|
// Health-check pings + connection-staleness check.
|
|
17215
17235
|
/** Send a health check message every 25 seconds */
|
|
17216
17236
|
pingInterval = 25 * 1000;
|
|
@@ -17239,6 +17259,7 @@ class StableWSConnection {
|
|
|
17239
17259
|
throw Error(`You've called connect twice, can only attempt 1 connection at the time`);
|
|
17240
17260
|
}
|
|
17241
17261
|
this.isDisconnected = false;
|
|
17262
|
+
this.lastConnectionError = undefined;
|
|
17242
17263
|
try {
|
|
17243
17264
|
const healthCheck = await this._connect(timeout);
|
|
17244
17265
|
this.consecutiveFailures = 0;
|
|
@@ -17269,6 +17290,7 @@ class StableWSConnection {
|
|
|
17269
17290
|
// _connect()'s catch) keeps a single failure from spawning two
|
|
17270
17291
|
// parallel chains - one from this catch and one from _reconnect's
|
|
17271
17292
|
// own catch when _connect was called from there.
|
|
17293
|
+
this.lastConnectionError = error;
|
|
17272
17294
|
this._reconnect();
|
|
17273
17295
|
}
|
|
17274
17296
|
}
|
|
@@ -17305,12 +17327,21 @@ class StableWSConnection {
|
|
|
17305
17327
|
(async () => {
|
|
17306
17328
|
await sleep(timeout);
|
|
17307
17329
|
this.isConnecting = false;
|
|
17308
|
-
|
|
17309
|
-
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
|
|
17313
|
-
|
|
17330
|
+
const e = this.lastConnectionError;
|
|
17331
|
+
const errorPayload = e
|
|
17332
|
+
? {
|
|
17333
|
+
code: e.code,
|
|
17334
|
+
StatusCode: e.StatusCode,
|
|
17335
|
+
message: e.message,
|
|
17336
|
+
isWSFailure: e.isWSFailure,
|
|
17337
|
+
}
|
|
17338
|
+
: {
|
|
17339
|
+
code: '',
|
|
17340
|
+
StatusCode: '',
|
|
17341
|
+
message: 'initial WS connection could not be established',
|
|
17342
|
+
isWSFailure: true,
|
|
17343
|
+
};
|
|
17344
|
+
throw new Error(JSON.stringify(errorPayload));
|
|
17314
17345
|
})(),
|
|
17315
17346
|
]);
|
|
17316
17347
|
};
|
|
@@ -17464,6 +17495,7 @@ class StableWSConnection {
|
|
|
17464
17495
|
}
|
|
17465
17496
|
catch (caught) {
|
|
17466
17497
|
const err = caught;
|
|
17498
|
+
this.lastConnectionError = err;
|
|
17467
17499
|
this.isConnecting = false;
|
|
17468
17500
|
this._log(`_connect() - Error - `, err);
|
|
17469
17501
|
// Reject THIS attempt's connection-id promise (P1) directly via the
|
|
@@ -18416,11 +18448,11 @@ class StreamClient {
|
|
|
18416
18448
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
18417
18449
|
};
|
|
18418
18450
|
getSdkVersion = () => this.options.clientAppIdentifier?.sdkVersion ||
|
|
18419
|
-
"1.55.
|
|
18451
|
+
"1.55.2";
|
|
18420
18452
|
getUserAgent = () => {
|
|
18421
18453
|
if (!this.cachedUserAgent) {
|
|
18422
18454
|
const { clientAppIdentifier = {} } = this.options;
|
|
18423
|
-
const { sdkName = 'js', sdkVersion = "1.55.
|
|
18455
|
+
const { sdkName = 'js', sdkVersion = "1.55.2", ...extras } = clientAppIdentifier;
|
|
18424
18456
|
this.cachedUserAgent = [
|
|
18425
18457
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
18426
18458
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|