@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.es.js
CHANGED
|
@@ -4927,7 +4927,7 @@ const toIceCandidate = (iceTrickle) => {
|
|
|
4927
4927
|
}
|
|
4928
4928
|
};
|
|
4929
4929
|
|
|
4930
|
-
const version = "1.55.
|
|
4930
|
+
const version = "1.55.2";
|
|
4931
4931
|
const [major, minor, patch] = version.split('.');
|
|
4932
4932
|
let sdkInfo = {
|
|
4933
4933
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -6282,6 +6282,12 @@ class CallState {
|
|
|
6282
6282
|
// trigger re-sorting of participants
|
|
6283
6283
|
this.setCurrentValue(this.participantsSubject, (ps) => ps);
|
|
6284
6284
|
};
|
|
6285
|
+
/**
|
|
6286
|
+
* Returns the comparator currently used to sort the participants.
|
|
6287
|
+
*/
|
|
6288
|
+
getSortParticipantsBy = () => {
|
|
6289
|
+
return this.sortParticipantsBy;
|
|
6290
|
+
};
|
|
6285
6291
|
/**
|
|
6286
6292
|
* Gets the current value of an observable, or undefined if the observable has
|
|
6287
6293
|
* not emitted a value yet.
|
|
@@ -9042,6 +9048,9 @@ class Publisher extends BasePeerConnection {
|
|
|
9042
9048
|
if (isAudioTrackType(trackType)) {
|
|
9043
9049
|
await this.updateAudioPublishOptions(trackType, options);
|
|
9044
9050
|
}
|
|
9051
|
+
if (track && !bundle.negotiated) {
|
|
9052
|
+
await this.negotiate();
|
|
9053
|
+
}
|
|
9045
9054
|
};
|
|
9046
9055
|
/**
|
|
9047
9056
|
* Updates the publish options for the given track type.
|
|
@@ -9298,6 +9307,10 @@ class Publisher extends BasePeerConnection {
|
|
|
9298
9307
|
throw new NegotiationError(response.error);
|
|
9299
9308
|
const { sdp: answerSdp } = response;
|
|
9300
9309
|
await this.pc.setRemoteDescription({ type: 'answer', sdp: answerSdp });
|
|
9310
|
+
for (const bundle of this.transceiverCache.items()) {
|
|
9311
|
+
if (bundle.transceiver.sender.track)
|
|
9312
|
+
bundle.negotiated = true;
|
|
9313
|
+
}
|
|
9301
9314
|
}
|
|
9302
9315
|
catch (err) {
|
|
9303
9316
|
// negotiation failed, rollback to the previous state
|
|
@@ -16343,6 +16356,12 @@ class Call {
|
|
|
16343
16356
|
setSortParticipantsBy = (criteria) => {
|
|
16344
16357
|
return this.state.setSortParticipantsBy(criteria);
|
|
16345
16358
|
};
|
|
16359
|
+
/**
|
|
16360
|
+
* Returns the comparator currently used to sort the participants.
|
|
16361
|
+
*/
|
|
16362
|
+
getSortParticipantsBy = () => {
|
|
16363
|
+
return this.state.getSortParticipantsBy();
|
|
16364
|
+
};
|
|
16346
16365
|
/**
|
|
16347
16366
|
* Sends a reaction to the other call participants.
|
|
16348
16367
|
*
|
|
@@ -17192,6 +17211,7 @@ class StableWSConnection {
|
|
|
17192
17211
|
consecutiveFailures = 0;
|
|
17193
17212
|
/** keep track of the total number of failures */
|
|
17194
17213
|
totalFailures = 0;
|
|
17214
|
+
lastConnectionError;
|
|
17195
17215
|
// Health-check pings + connection-staleness check.
|
|
17196
17216
|
/** Send a health check message every 25 seconds */
|
|
17197
17217
|
pingInterval = 25 * 1000;
|
|
@@ -17220,6 +17240,7 @@ class StableWSConnection {
|
|
|
17220
17240
|
throw Error(`You've called connect twice, can only attempt 1 connection at the time`);
|
|
17221
17241
|
}
|
|
17222
17242
|
this.isDisconnected = false;
|
|
17243
|
+
this.lastConnectionError = undefined;
|
|
17223
17244
|
try {
|
|
17224
17245
|
const healthCheck = await this._connect(timeout);
|
|
17225
17246
|
this.consecutiveFailures = 0;
|
|
@@ -17250,6 +17271,7 @@ class StableWSConnection {
|
|
|
17250
17271
|
// _connect()'s catch) keeps a single failure from spawning two
|
|
17251
17272
|
// parallel chains - one from this catch and one from _reconnect's
|
|
17252
17273
|
// own catch when _connect was called from there.
|
|
17274
|
+
this.lastConnectionError = error;
|
|
17253
17275
|
this._reconnect();
|
|
17254
17276
|
}
|
|
17255
17277
|
}
|
|
@@ -17286,12 +17308,21 @@ class StableWSConnection {
|
|
|
17286
17308
|
(async () => {
|
|
17287
17309
|
await sleep(timeout);
|
|
17288
17310
|
this.isConnecting = false;
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
|
|
17294
|
-
|
|
17311
|
+
const e = this.lastConnectionError;
|
|
17312
|
+
const errorPayload = e
|
|
17313
|
+
? {
|
|
17314
|
+
code: e.code,
|
|
17315
|
+
StatusCode: e.StatusCode,
|
|
17316
|
+
message: e.message,
|
|
17317
|
+
isWSFailure: e.isWSFailure,
|
|
17318
|
+
}
|
|
17319
|
+
: {
|
|
17320
|
+
code: '',
|
|
17321
|
+
StatusCode: '',
|
|
17322
|
+
message: 'initial WS connection could not be established',
|
|
17323
|
+
isWSFailure: true,
|
|
17324
|
+
};
|
|
17325
|
+
throw new Error(JSON.stringify(errorPayload));
|
|
17295
17326
|
})(),
|
|
17296
17327
|
]);
|
|
17297
17328
|
};
|
|
@@ -17445,6 +17476,7 @@ class StableWSConnection {
|
|
|
17445
17476
|
}
|
|
17446
17477
|
catch (caught) {
|
|
17447
17478
|
const err = caught;
|
|
17479
|
+
this.lastConnectionError = err;
|
|
17448
17480
|
this.isConnecting = false;
|
|
17449
17481
|
this._log(`_connect() - Error - `, err);
|
|
17450
17482
|
// Reject THIS attempt's connection-id promise (P1) directly via the
|
|
@@ -18397,11 +18429,11 @@ class StreamClient {
|
|
|
18397
18429
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
18398
18430
|
};
|
|
18399
18431
|
getSdkVersion = () => this.options.clientAppIdentifier?.sdkVersion ||
|
|
18400
|
-
"1.55.
|
|
18432
|
+
"1.55.2";
|
|
18401
18433
|
getUserAgent = () => {
|
|
18402
18434
|
if (!this.cachedUserAgent) {
|
|
18403
18435
|
const { clientAppIdentifier = {} } = this.options;
|
|
18404
|
-
const { sdkName = 'js', sdkVersion = "1.55.
|
|
18436
|
+
const { sdkName = 'js', sdkVersion = "1.55.2", ...extras } = clientAppIdentifier;
|
|
18405
18437
|
this.cachedUserAgent = [
|
|
18406
18438
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
18407
18439
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|