@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.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.1";
|
|
4931
4931
|
const [major, minor, patch] = version.split('.');
|
|
4932
4932
|
let sdkInfo = {
|
|
4933
4933
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -9042,6 +9042,9 @@ class Publisher extends BasePeerConnection {
|
|
|
9042
9042
|
if (isAudioTrackType(trackType)) {
|
|
9043
9043
|
await this.updateAudioPublishOptions(trackType, options);
|
|
9044
9044
|
}
|
|
9045
|
+
if (track && !bundle.negotiated) {
|
|
9046
|
+
await this.negotiate();
|
|
9047
|
+
}
|
|
9045
9048
|
};
|
|
9046
9049
|
/**
|
|
9047
9050
|
* Updates the publish options for the given track type.
|
|
@@ -9298,6 +9301,10 @@ class Publisher extends BasePeerConnection {
|
|
|
9298
9301
|
throw new NegotiationError(response.error);
|
|
9299
9302
|
const { sdp: answerSdp } = response;
|
|
9300
9303
|
await this.pc.setRemoteDescription({ type: 'answer', sdp: answerSdp });
|
|
9304
|
+
for (const bundle of this.transceiverCache.items()) {
|
|
9305
|
+
if (bundle.transceiver.sender.track)
|
|
9306
|
+
bundle.negotiated = true;
|
|
9307
|
+
}
|
|
9301
9308
|
}
|
|
9302
9309
|
catch (err) {
|
|
9303
9310
|
// negotiation failed, rollback to the previous state
|
|
@@ -17192,6 +17199,7 @@ class StableWSConnection {
|
|
|
17192
17199
|
consecutiveFailures = 0;
|
|
17193
17200
|
/** keep track of the total number of failures */
|
|
17194
17201
|
totalFailures = 0;
|
|
17202
|
+
lastConnectionError;
|
|
17195
17203
|
// Health-check pings + connection-staleness check.
|
|
17196
17204
|
/** Send a health check message every 25 seconds */
|
|
17197
17205
|
pingInterval = 25 * 1000;
|
|
@@ -17220,6 +17228,7 @@ class StableWSConnection {
|
|
|
17220
17228
|
throw Error(`You've called connect twice, can only attempt 1 connection at the time`);
|
|
17221
17229
|
}
|
|
17222
17230
|
this.isDisconnected = false;
|
|
17231
|
+
this.lastConnectionError = undefined;
|
|
17223
17232
|
try {
|
|
17224
17233
|
const healthCheck = await this._connect(timeout);
|
|
17225
17234
|
this.consecutiveFailures = 0;
|
|
@@ -17250,6 +17259,7 @@ class StableWSConnection {
|
|
|
17250
17259
|
// _connect()'s catch) keeps a single failure from spawning two
|
|
17251
17260
|
// parallel chains - one from this catch and one from _reconnect's
|
|
17252
17261
|
// own catch when _connect was called from there.
|
|
17262
|
+
this.lastConnectionError = error;
|
|
17253
17263
|
this._reconnect();
|
|
17254
17264
|
}
|
|
17255
17265
|
}
|
|
@@ -17286,12 +17296,21 @@ class StableWSConnection {
|
|
|
17286
17296
|
(async () => {
|
|
17287
17297
|
await sleep(timeout);
|
|
17288
17298
|
this.isConnecting = false;
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
|
|
17292
|
-
|
|
17293
|
-
|
|
17294
|
-
|
|
17299
|
+
const e = this.lastConnectionError;
|
|
17300
|
+
const errorPayload = e
|
|
17301
|
+
? {
|
|
17302
|
+
code: e.code,
|
|
17303
|
+
StatusCode: e.StatusCode,
|
|
17304
|
+
message: e.message,
|
|
17305
|
+
isWSFailure: e.isWSFailure,
|
|
17306
|
+
}
|
|
17307
|
+
: {
|
|
17308
|
+
code: '',
|
|
17309
|
+
StatusCode: '',
|
|
17310
|
+
message: 'initial WS connection could not be established',
|
|
17311
|
+
isWSFailure: true,
|
|
17312
|
+
};
|
|
17313
|
+
throw new Error(JSON.stringify(errorPayload));
|
|
17295
17314
|
})(),
|
|
17296
17315
|
]);
|
|
17297
17316
|
};
|
|
@@ -17445,6 +17464,7 @@ class StableWSConnection {
|
|
|
17445
17464
|
}
|
|
17446
17465
|
catch (caught) {
|
|
17447
17466
|
const err = caught;
|
|
17467
|
+
this.lastConnectionError = err;
|
|
17448
17468
|
this.isConnecting = false;
|
|
17449
17469
|
this._log(`_connect() - Error - `, err);
|
|
17450
17470
|
// Reject THIS attempt's connection-id promise (P1) directly via the
|
|
@@ -18397,11 +18417,11 @@ class StreamClient {
|
|
|
18397
18417
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
18398
18418
|
};
|
|
18399
18419
|
getSdkVersion = () => this.options.clientAppIdentifier?.sdkVersion ||
|
|
18400
|
-
"1.55.
|
|
18420
|
+
"1.55.1";
|
|
18401
18421
|
getUserAgent = () => {
|
|
18402
18422
|
if (!this.cachedUserAgent) {
|
|
18403
18423
|
const { clientAppIdentifier = {} } = this.options;
|
|
18404
|
-
const { sdkName = 'js', sdkVersion = "1.55.
|
|
18424
|
+
const { sdkName = 'js', sdkVersion = "1.55.1", ...extras } = clientAppIdentifier;
|
|
18405
18425
|
this.cachedUserAgent = [
|
|
18406
18426
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
18407
18427
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|