@stream-io/video-client 1.55.0 → 1.55.1
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 +7 -0
- package/dist/index.browser.es.js +29 -9
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +29 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +29 -9
- package/dist/index.es.js.map +1 -1
- package/dist/src/coordinator/connection/connection.d.ts +1 -0
- package/dist/src/rtc/types.d.ts +1 -0
- package/package.json +2 -2
- 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/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.1";
|
|
4950
4950
|
const [major, minor, patch] = version.split('.');
|
|
4951
4951
|
let sdkInfo = {
|
|
4952
4952
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -9061,6 +9061,9 @@ class Publisher extends BasePeerConnection {
|
|
|
9061
9061
|
if (isAudioTrackType(trackType)) {
|
|
9062
9062
|
await this.updateAudioPublishOptions(trackType, options);
|
|
9063
9063
|
}
|
|
9064
|
+
if (track && !bundle.negotiated) {
|
|
9065
|
+
await this.negotiate();
|
|
9066
|
+
}
|
|
9064
9067
|
};
|
|
9065
9068
|
/**
|
|
9066
9069
|
* Updates the publish options for the given track type.
|
|
@@ -9317,6 +9320,10 @@ class Publisher extends BasePeerConnection {
|
|
|
9317
9320
|
throw new NegotiationError(response.error);
|
|
9318
9321
|
const { sdp: answerSdp } = response;
|
|
9319
9322
|
await this.pc.setRemoteDescription({ type: 'answer', sdp: answerSdp });
|
|
9323
|
+
for (const bundle of this.transceiverCache.items()) {
|
|
9324
|
+
if (bundle.transceiver.sender.track)
|
|
9325
|
+
bundle.negotiated = true;
|
|
9326
|
+
}
|
|
9320
9327
|
}
|
|
9321
9328
|
catch (err) {
|
|
9322
9329
|
// negotiation failed, rollback to the previous state
|
|
@@ -17211,6 +17218,7 @@ class StableWSConnection {
|
|
|
17211
17218
|
consecutiveFailures = 0;
|
|
17212
17219
|
/** keep track of the total number of failures */
|
|
17213
17220
|
totalFailures = 0;
|
|
17221
|
+
lastConnectionError;
|
|
17214
17222
|
// Health-check pings + connection-staleness check.
|
|
17215
17223
|
/** Send a health check message every 25 seconds */
|
|
17216
17224
|
pingInterval = 25 * 1000;
|
|
@@ -17239,6 +17247,7 @@ class StableWSConnection {
|
|
|
17239
17247
|
throw Error(`You've called connect twice, can only attempt 1 connection at the time`);
|
|
17240
17248
|
}
|
|
17241
17249
|
this.isDisconnected = false;
|
|
17250
|
+
this.lastConnectionError = undefined;
|
|
17242
17251
|
try {
|
|
17243
17252
|
const healthCheck = await this._connect(timeout);
|
|
17244
17253
|
this.consecutiveFailures = 0;
|
|
@@ -17269,6 +17278,7 @@ class StableWSConnection {
|
|
|
17269
17278
|
// _connect()'s catch) keeps a single failure from spawning two
|
|
17270
17279
|
// parallel chains - one from this catch and one from _reconnect's
|
|
17271
17280
|
// own catch when _connect was called from there.
|
|
17281
|
+
this.lastConnectionError = error;
|
|
17272
17282
|
this._reconnect();
|
|
17273
17283
|
}
|
|
17274
17284
|
}
|
|
@@ -17305,12 +17315,21 @@ class StableWSConnection {
|
|
|
17305
17315
|
(async () => {
|
|
17306
17316
|
await sleep(timeout);
|
|
17307
17317
|
this.isConnecting = false;
|
|
17308
|
-
|
|
17309
|
-
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
|
|
17313
|
-
|
|
17318
|
+
const e = this.lastConnectionError;
|
|
17319
|
+
const errorPayload = e
|
|
17320
|
+
? {
|
|
17321
|
+
code: e.code,
|
|
17322
|
+
StatusCode: e.StatusCode,
|
|
17323
|
+
message: e.message,
|
|
17324
|
+
isWSFailure: e.isWSFailure,
|
|
17325
|
+
}
|
|
17326
|
+
: {
|
|
17327
|
+
code: '',
|
|
17328
|
+
StatusCode: '',
|
|
17329
|
+
message: 'initial WS connection could not be established',
|
|
17330
|
+
isWSFailure: true,
|
|
17331
|
+
};
|
|
17332
|
+
throw new Error(JSON.stringify(errorPayload));
|
|
17314
17333
|
})(),
|
|
17315
17334
|
]);
|
|
17316
17335
|
};
|
|
@@ -17464,6 +17483,7 @@ class StableWSConnection {
|
|
|
17464
17483
|
}
|
|
17465
17484
|
catch (caught) {
|
|
17466
17485
|
const err = caught;
|
|
17486
|
+
this.lastConnectionError = err;
|
|
17467
17487
|
this.isConnecting = false;
|
|
17468
17488
|
this._log(`_connect() - Error - `, err);
|
|
17469
17489
|
// Reject THIS attempt's connection-id promise (P1) directly via the
|
|
@@ -18416,11 +18436,11 @@ class StreamClient {
|
|
|
18416
18436
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
18417
18437
|
};
|
|
18418
18438
|
getSdkVersion = () => this.options.clientAppIdentifier?.sdkVersion ||
|
|
18419
|
-
"1.55.
|
|
18439
|
+
"1.55.1";
|
|
18420
18440
|
getUserAgent = () => {
|
|
18421
18441
|
if (!this.cachedUserAgent) {
|
|
18422
18442
|
const { clientAppIdentifier = {} } = this.options;
|
|
18423
|
-
const { sdkName = 'js', sdkVersion = "1.55.
|
|
18443
|
+
const { sdkName = 'js', sdkVersion = "1.55.1", ...extras } = clientAppIdentifier;
|
|
18424
18444
|
this.cachedUserAgent = [
|
|
18425
18445
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
18426
18446
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|