@stream-io/video-client 1.56.0 → 1.57.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 +10 -0
- package/dist/index.browser.es.js +39 -19
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +39 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +39 -19
- package/dist/index.es.js.map +1 -1
- package/dist/src/helpers/MediaPlaybackWatchdog.d.ts +4 -0
- package/package.json +11 -11
- package/src/devices/__tests__/MicrophoneManagerRN.test.ts +1 -2
- package/src/devices/devicePersistence.ts +1 -2
- package/src/helpers/MediaPlaybackWatchdog.ts +35 -16
- package/src/helpers/__tests__/MediaPlaybackWatchdog.test.ts +137 -8
- package/src/helpers/__tests__/ViewportTracker.test.ts +1 -2
- package/src/reporting/ClientEventReporter.ts +2 -8
- package/src/rtc/types.ts +1 -2
- package/src/stats/rtc/types.ts +8 -2
- package/src/store/CallState.ts +1 -2
- package/src/types.ts +1 -4
package/dist/index.cjs.js
CHANGED
|
@@ -4946,7 +4946,7 @@ const toIceCandidate = (iceTrickle) => {
|
|
|
4946
4946
|
}
|
|
4947
4947
|
};
|
|
4948
4948
|
|
|
4949
|
-
const version = "1.
|
|
4949
|
+
const version = "1.57.0";
|
|
4950
4950
|
const [major, minor, patch] = version.split('.');
|
|
4951
4951
|
let sdkInfo = {
|
|
4952
4952
|
type: SdkType.PLAIN_JAVASCRIPT,
|
|
@@ -11216,8 +11216,10 @@ class MediaPlaybackWatchdog {
|
|
|
11216
11216
|
tracer;
|
|
11217
11217
|
controller = new AbortController();
|
|
11218
11218
|
pendingTimer;
|
|
11219
|
+
settleTimer;
|
|
11219
11220
|
attempt = 0;
|
|
11220
11221
|
disposed = false;
|
|
11222
|
+
stopped = false;
|
|
11221
11223
|
constructor(opts) {
|
|
11222
11224
|
this.element = opts.element;
|
|
11223
11225
|
this.kind = opts.kind;
|
|
@@ -11238,33 +11240,49 @@ class MediaPlaybackWatchdog {
|
|
|
11238
11240
|
return;
|
|
11239
11241
|
this.disposed = true;
|
|
11240
11242
|
this.controller.abort();
|
|
11243
|
+
this.clearTimers();
|
|
11244
|
+
};
|
|
11245
|
+
clearTimers = () => {
|
|
11241
11246
|
if (this.pendingTimer)
|
|
11242
11247
|
clearTimeout(this.pendingTimer);
|
|
11243
11248
|
this.pendingTimer = undefined;
|
|
11249
|
+
if (this.settleTimer)
|
|
11250
|
+
clearTimeout(this.settleTimer);
|
|
11251
|
+
this.settleTimer = undefined;
|
|
11244
11252
|
};
|
|
11245
11253
|
onPlaying = () => {
|
|
11246
|
-
if (this.attempt > 0) {
|
|
11247
|
-
this.tracer.trace('mediaPlayback.recover.success', {
|
|
11248
|
-
kind: this.kind,
|
|
11249
|
-
attempts: this.attempt,
|
|
11250
|
-
});
|
|
11251
|
-
}
|
|
11252
|
-
this.attempt = 0;
|
|
11253
11254
|
if (this.pendingTimer)
|
|
11254
11255
|
clearTimeout(this.pendingTimer);
|
|
11255
11256
|
this.pendingTimer = undefined;
|
|
11257
|
+
if (this.attempt === 0 || this.settleTimer)
|
|
11258
|
+
return;
|
|
11259
|
+
this.settleTimer ??= setTimeout(this.onSettled, 1000);
|
|
11260
|
+
};
|
|
11261
|
+
onSettled = () => {
|
|
11262
|
+
this.settleTimer = undefined;
|
|
11263
|
+
if (this.element.paused)
|
|
11264
|
+
return;
|
|
11265
|
+
this.tracer.trace('mediaPlayback.recover.success', {
|
|
11266
|
+
kind: this.kind,
|
|
11267
|
+
attempts: this.attempt,
|
|
11268
|
+
});
|
|
11269
|
+
this.attempt = 0;
|
|
11270
|
+
this.stopped = false;
|
|
11256
11271
|
};
|
|
11257
11272
|
onPauseOrSuspend = (event) => {
|
|
11258
|
-
if (this.disposed)
|
|
11273
|
+
if (this.disposed || this.stopped)
|
|
11259
11274
|
return;
|
|
11260
11275
|
this.tracer.trace('mediaPlayback.paused', {
|
|
11261
11276
|
kind: this.kind,
|
|
11262
11277
|
reason: event.type,
|
|
11263
11278
|
});
|
|
11279
|
+
if (this.settleTimer)
|
|
11280
|
+
clearTimeout(this.settleTimer);
|
|
11281
|
+
this.settleTimer = undefined;
|
|
11264
11282
|
this.scheduleRecovery();
|
|
11265
11283
|
};
|
|
11266
11284
|
scheduleRecovery = () => {
|
|
11267
|
-
if (this.disposed || this.pendingTimer)
|
|
11285
|
+
if (this.disposed || this.stopped || this.pendingTimer)
|
|
11268
11286
|
return;
|
|
11269
11287
|
const skipReason = this.computeSkipReason();
|
|
11270
11288
|
if (skipReason) {
|
|
@@ -11274,6 +11292,15 @@ class MediaPlaybackWatchdog {
|
|
|
11274
11292
|
});
|
|
11275
11293
|
return;
|
|
11276
11294
|
}
|
|
11295
|
+
if (this.attempt >= 10) {
|
|
11296
|
+
this.stopped = true;
|
|
11297
|
+
this.clearTimers();
|
|
11298
|
+
this.tracer.trace('mediaPlayback.recover.giveUp', {
|
|
11299
|
+
kind: this.kind,
|
|
11300
|
+
attempts: this.attempt,
|
|
11301
|
+
});
|
|
11302
|
+
return;
|
|
11303
|
+
}
|
|
11277
11304
|
const delay = this.attempt === 0 ? 0 : retryInterval(this.attempt);
|
|
11278
11305
|
this.pendingTimer = setTimeout(this.attemptPlay, delay);
|
|
11279
11306
|
};
|
|
@@ -11309,13 +11336,6 @@ class MediaPlaybackWatchdog {
|
|
|
11309
11336
|
if (this.disposed)
|
|
11310
11337
|
return;
|
|
11311
11338
|
this.logger.warn(`Failed to recover ${this.kind} playback`, err);
|
|
11312
|
-
if (this.attempt >= 10) {
|
|
11313
|
-
this.tracer.trace('mediaPlayback.recover.giveUp', {
|
|
11314
|
-
kind: this.kind,
|
|
11315
|
-
attempts: this.attempt,
|
|
11316
|
-
});
|
|
11317
|
-
return;
|
|
11318
|
-
}
|
|
11319
11339
|
this.scheduleRecovery();
|
|
11320
11340
|
}
|
|
11321
11341
|
};
|
|
@@ -18510,11 +18530,11 @@ class StreamClient {
|
|
|
18510
18530
|
return await this.wsConnection.connect(this.defaultWSTimeout);
|
|
18511
18531
|
};
|
|
18512
18532
|
getSdkVersion = () => this.options.clientAppIdentifier?.sdkVersion ||
|
|
18513
|
-
"1.
|
|
18533
|
+
"1.57.0";
|
|
18514
18534
|
getUserAgent = () => {
|
|
18515
18535
|
if (!this.cachedUserAgent) {
|
|
18516
18536
|
const { clientAppIdentifier = {} } = this.options;
|
|
18517
|
-
const { sdkName = 'js', sdkVersion = "1.
|
|
18537
|
+
const { sdkName = 'js', sdkVersion = "1.57.0", ...extras } = clientAppIdentifier;
|
|
18518
18538
|
this.cachedUserAgent = [
|
|
18519
18539
|
`stream-video-${sdkName}-v${sdkVersion}`,
|
|
18520
18540
|
...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
|