@stream-io/video-client 1.51.0 → 1.52.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/index.browser.es.js +311 -14
  3. package/dist/index.browser.es.js.map +1 -1
  4. package/dist/index.cjs.js +311 -13
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.es.js +311 -14
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/src/gen/video/sfu/event/events.d.ts +4 -0
  9. package/dist/src/gen/video/sfu/models/models.d.ts +204 -2
  10. package/dist/src/gen/video/sfu/signal_rpc/signal.client.d.ts +9 -1
  11. package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +67 -1
  12. package/dist/src/helpers/participantUtils.d.ts +10 -0
  13. package/dist/src/rtc/BasePeerConnection.d.ts +1 -1
  14. package/dist/src/rtc/types.d.ts +1 -0
  15. package/dist/src/stats/rtc/StatsTracer.d.ts +2 -1
  16. package/dist/src/stats/utils.d.ts +1 -0
  17. package/package.json +14 -14
  18. package/src/Call.ts +5 -1
  19. package/src/devices/__tests__/CameraManager.test.ts +3 -1
  20. package/src/devices/__tests__/DeviceManager.test.ts +3 -1
  21. package/src/devices/__tests__/MicrophoneManager.test.ts +3 -1
  22. package/src/devices/__tests__/MicrophoneManagerRN.test.ts +3 -1
  23. package/src/devices/__tests__/ScreenShareManager.test.ts +3 -1
  24. package/src/devices/__tests__/web-audio.mocks.ts +3 -1
  25. package/src/gen/video/sfu/event/events.ts +10 -0
  26. package/src/gen/video/sfu/models/models.ts +338 -0
  27. package/src/gen/video/sfu/signal_rpc/signal.client.ts +28 -2
  28. package/src/gen/video/sfu/signal_rpc/signal.ts +121 -15
  29. package/src/helpers/__tests__/DynascaleManager.test.ts +8 -7
  30. package/src/helpers/__tests__/browsers.test.ts +4 -4
  31. package/src/helpers/__tests__/participantUtils.test.ts +47 -0
  32. package/src/helpers/client-details.ts +4 -1
  33. package/src/helpers/participantUtils.ts +15 -0
  34. package/src/rtc/BasePeerConnection.ts +7 -1
  35. package/src/rtc/Subscriber.ts +1 -0
  36. package/src/rtc/__tests__/Subscriber.test.ts +5 -1
  37. package/src/rtc/__tests__/mocks/webrtc.mocks.ts +16 -15
  38. package/src/rtc/types.ts +1 -0
  39. package/src/stats/rtc/StatsTracer.ts +25 -4
  40. package/src/stats/rtc/__tests__/StatsTracer.test.ts +155 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.52.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.51.0...@stream-io/video-client-1.52.0) (2026-06-01)
6
+
7
+ - **deps:** upgrade React Native 0.85, React 19.2, Vite 8/Vitest 4, and Expo 56 ([#2268](https://github.com/GetStream/stream-video-js/issues/2268)) ([2c8ab9d](https://github.com/GetStream/stream-video-js/commit/2c8ab9d9238f3700dabbd04c9ce5bf3aaa4c7a13))
8
+
9
+ ### Features
10
+
11
+ - **client:** add hasInterruptedTrack helper ([#2266](https://github.com/GetStream/stream-video-js/issues/2266)) ([c723eb6](https://github.com/GetStream/stream-video-js/commit/c723eb67bffcb00edc03e4960a0d3a600bba8687))
12
+ - **client:** echo negotiationId in subscriber offer answer ([#2166](https://github.com/GetStream/stream-video-js/issues/2166)) ([749e0ad](https://github.com/GetStream/stream-video-js/commit/749e0ad025d579cf2a2792e6016f5eaffb9ee7a7))
13
+
14
+ ### Bug Fixes
15
+
16
+ - **client:** clamp drifted getStats timestamps to wall time ([#2258](https://github.com/GetStream/stream-video-js/issues/2258)) ([9d96df5](https://github.com/GetStream/stream-video-js/commit/9d96df552337fea27285a4260a4d1d76b39eb7b7))
17
+
5
18
  ## [1.51.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.50.0...@stream-io/video-client-1.51.0) (2026-05-26)
6
19
 
7
20
  ### Features
@@ -1186,6 +1186,14 @@ var SdkType;
1186
1186
  * @generated from protobuf enum value: SDK_TYPE_PLAIN_JAVASCRIPT = 9;
1187
1187
  */
1188
1188
  SdkType[SdkType["PLAIN_JAVASCRIPT"] = 9] = "PLAIN_JAVASCRIPT";
1189
+ /**
1190
+ * @generated from protobuf enum value: SDK_TYPE_PYTHON = 10;
1191
+ */
1192
+ SdkType[SdkType["PYTHON"] = 10] = "PYTHON";
1193
+ /**
1194
+ * @generated from protobuf enum value: SDK_TYPE_VISION_AGENTS = 11;
1195
+ */
1196
+ SdkType[SdkType["VISION_AGENTS"] = 11] = "VISION_AGENTS";
1189
1197
  })(SdkType || (SdkType = {}));
1190
1198
  /**
1191
1199
  * @generated from protobuf enum stream.video.sfu.models.TrackUnpublishReason
@@ -1397,6 +1405,12 @@ var ClientCapability;
1397
1405
  * @generated from protobuf enum value: CLIENT_CAPABILITY_SUBSCRIBER_VIDEO_PAUSE = 1;
1398
1406
  */
1399
1407
  ClientCapability[ClientCapability["SUBSCRIBER_VIDEO_PAUSE"] = 1] = "SUBSCRIBER_VIDEO_PAUSE";
1408
+ /**
1409
+ * Instructs SFU that stats will be sent to the coordinator
1410
+ *
1411
+ * @generated from protobuf enum value: CLIENT_CAPABILITY_COORDINATOR_STATS = 2;
1412
+ */
1413
+ ClientCapability[ClientCapability["COORDINATOR_STATS"] = 2] = "COORDINATOR_STATS";
1400
1414
  })(ClientCapability || (ClientCapability = {}));
1401
1415
  /**
1402
1416
  * DegradationPreference represents the RTCDegradationPreference from WebRTC.
@@ -1862,6 +1876,12 @@ class ClientDetails$Type extends MessageType {
1862
1876
  { no: 2, name: 'os', kind: 'message', T: () => OS },
1863
1877
  { no: 3, name: 'browser', kind: 'message', T: () => Browser },
1864
1878
  { no: 4, name: 'device', kind: 'message', T: () => Device },
1879
+ {
1880
+ no: 5,
1881
+ name: 'webrtc_version',
1882
+ kind: 'scalar',
1883
+ T: 9 /*ScalarType.STRING*/,
1884
+ },
1865
1885
  ]);
1866
1886
  }
1867
1887
  }
@@ -2134,6 +2154,171 @@ class PerformanceStats$Type extends MessageType {
2134
2154
  * @generated MessageType for protobuf message stream.video.sfu.models.PerformanceStats
2135
2155
  */
2136
2156
  const PerformanceStats = new PerformanceStats$Type();
2157
+ // @generated message type with reflection information, may provide speed optimized methods
2158
+ class RtpBase$Type extends MessageType {
2159
+ constructor() {
2160
+ super('stream.video.sfu.models.RtpBase', [
2161
+ { no: 1, name: 'ssrc', kind: 'scalar', T: 13 /*ScalarType.UINT32*/ },
2162
+ { no: 2, name: 'kind', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
2163
+ {
2164
+ no: 3,
2165
+ name: 'timestamp_ms',
2166
+ kind: 'scalar',
2167
+ T: 1 /*ScalarType.DOUBLE*/,
2168
+ },
2169
+ ]);
2170
+ }
2171
+ }
2172
+ /**
2173
+ * @generated MessageType for protobuf message stream.video.sfu.models.RtpBase
2174
+ */
2175
+ const RtpBase = new RtpBase$Type();
2176
+ // @generated message type with reflection information, may provide speed optimized methods
2177
+ class InboundRtp$Type extends MessageType {
2178
+ constructor() {
2179
+ super('stream.video.sfu.models.InboundRtp', [
2180
+ { no: 1, name: 'base', kind: 'message', T: () => RtpBase },
2181
+ {
2182
+ no: 2,
2183
+ name: 'jitter_seconds',
2184
+ kind: 'scalar',
2185
+ T: 1 /*ScalarType.DOUBLE*/,
2186
+ },
2187
+ {
2188
+ no: 3,
2189
+ name: 'packets_received',
2190
+ kind: 'scalar',
2191
+ T: 4 /*ScalarType.UINT64*/,
2192
+ },
2193
+ {
2194
+ no: 4,
2195
+ name: 'packets_lost',
2196
+ kind: 'scalar',
2197
+ T: 4 /*ScalarType.UINT64*/,
2198
+ },
2199
+ {
2200
+ no: 5,
2201
+ name: 'packet_loss_percent',
2202
+ kind: 'scalar',
2203
+ T: 1 /*ScalarType.DOUBLE*/,
2204
+ },
2205
+ {
2206
+ no: 10,
2207
+ name: 'concealment_events',
2208
+ kind: 'scalar',
2209
+ T: 13 /*ScalarType.UINT32*/,
2210
+ },
2211
+ {
2212
+ no: 11,
2213
+ name: 'concealment_percent',
2214
+ kind: 'scalar',
2215
+ T: 1 /*ScalarType.DOUBLE*/,
2216
+ },
2217
+ { no: 20, name: 'fps', kind: 'scalar', T: 1 /*ScalarType.DOUBLE*/ },
2218
+ {
2219
+ no: 21,
2220
+ name: 'freeze_duration_seconds',
2221
+ kind: 'scalar',
2222
+ T: 1 /*ScalarType.DOUBLE*/,
2223
+ },
2224
+ {
2225
+ no: 22,
2226
+ name: 'avg_decode_time_seconds',
2227
+ kind: 'scalar',
2228
+ T: 1 /*ScalarType.DOUBLE*/,
2229
+ },
2230
+ {
2231
+ no: 23,
2232
+ name: 'min_dimension_px',
2233
+ kind: 'scalar',
2234
+ T: 13 /*ScalarType.UINT32*/,
2235
+ },
2236
+ ]);
2237
+ }
2238
+ }
2239
+ /**
2240
+ * @generated MessageType for protobuf message stream.video.sfu.models.InboundRtp
2241
+ */
2242
+ const InboundRtp = new InboundRtp$Type();
2243
+ // @generated message type with reflection information, may provide speed optimized methods
2244
+ class OutboundRtp$Type extends MessageType {
2245
+ constructor() {
2246
+ super('stream.video.sfu.models.OutboundRtp', [
2247
+ { no: 1, name: 'base', kind: 'message', T: () => RtpBase },
2248
+ { no: 10, name: 'fps', kind: 'scalar', T: 1 /*ScalarType.DOUBLE*/ },
2249
+ {
2250
+ no: 11,
2251
+ name: 'avg_encode_time_seconds',
2252
+ kind: 'scalar',
2253
+ T: 1 /*ScalarType.DOUBLE*/,
2254
+ },
2255
+ {
2256
+ no: 12,
2257
+ name: 'bitrate_bps',
2258
+ kind: 'scalar',
2259
+ T: 1 /*ScalarType.DOUBLE*/,
2260
+ },
2261
+ {
2262
+ no: 13,
2263
+ name: 'min_dimension_px',
2264
+ kind: 'scalar',
2265
+ T: 13 /*ScalarType.UINT32*/,
2266
+ },
2267
+ ]);
2268
+ }
2269
+ }
2270
+ /**
2271
+ * @generated MessageType for protobuf message stream.video.sfu.models.OutboundRtp
2272
+ */
2273
+ const OutboundRtp = new OutboundRtp$Type();
2274
+ // @generated message type with reflection information, may provide speed optimized methods
2275
+ class RemoteInboundRtp$Type extends MessageType {
2276
+ constructor() {
2277
+ super('stream.video.sfu.models.RemoteInboundRtp', [
2278
+ { no: 1, name: 'base', kind: 'message', T: () => RtpBase },
2279
+ {
2280
+ no: 2,
2281
+ name: 'jitter_seconds',
2282
+ kind: 'scalar',
2283
+ T: 1 /*ScalarType.DOUBLE*/,
2284
+ },
2285
+ {
2286
+ no: 3,
2287
+ name: 'round_trip_time_s',
2288
+ kind: 'scalar',
2289
+ T: 1 /*ScalarType.DOUBLE*/,
2290
+ },
2291
+ ]);
2292
+ }
2293
+ }
2294
+ /**
2295
+ * @generated MessageType for protobuf message stream.video.sfu.models.RemoteInboundRtp
2296
+ */
2297
+ const RemoteInboundRtp = new RemoteInboundRtp$Type();
2298
+ // @generated message type with reflection information, may provide speed optimized methods
2299
+ class RemoteOutboundRtp$Type extends MessageType {
2300
+ constructor() {
2301
+ super('stream.video.sfu.models.RemoteOutboundRtp', [
2302
+ { no: 1, name: 'base', kind: 'message', T: () => RtpBase },
2303
+ {
2304
+ no: 2,
2305
+ name: 'jitter_seconds',
2306
+ kind: 'scalar',
2307
+ T: 1 /*ScalarType.DOUBLE*/,
2308
+ },
2309
+ {
2310
+ no: 3,
2311
+ name: 'round_trip_time_s',
2312
+ kind: 'scalar',
2313
+ T: 1 /*ScalarType.DOUBLE*/,
2314
+ },
2315
+ ]);
2316
+ }
2317
+ }
2318
+ /**
2319
+ * @generated MessageType for protobuf message stream.video.sfu.models.RemoteOutboundRtp
2320
+ */
2321
+ const RemoteOutboundRtp = new RemoteOutboundRtp$Type();
2137
2322
 
2138
2323
  var models = /*#__PURE__*/Object.freeze({
2139
2324
  __proto__: null,
@@ -2158,8 +2343,10 @@ var models = /*#__PURE__*/Object.freeze({
2158
2343
  get ErrorCode () { return ErrorCode; },
2159
2344
  get GoAwayReason () { return GoAwayReason; },
2160
2345
  ICETrickle: ICETrickle$1,
2346
+ InboundRtp: InboundRtp,
2161
2347
  InputDevices: InputDevices,
2162
2348
  OS: OS,
2349
+ OutboundRtp: OutboundRtp,
2163
2350
  Participant: Participant,
2164
2351
  ParticipantCount: ParticipantCount,
2165
2352
  get ParticipantSource () { return ParticipantSource; },
@@ -2168,6 +2355,9 @@ var models = /*#__PURE__*/Object.freeze({
2168
2355
  Pin: Pin,
2169
2356
  PublishOption: PublishOption,
2170
2357
  RTMPIngress: RTMPIngress,
2358
+ RemoteInboundRtp: RemoteInboundRtp,
2359
+ RemoteOutboundRtp: RemoteOutboundRtp,
2360
+ RtpBase: RtpBase,
2171
2361
  Sdk: Sdk,
2172
2362
  get SdkType () { return SdkType; },
2173
2363
  StreamQuality: StreamQuality,
@@ -2285,6 +2475,62 @@ class Telemetry$Type extends MessageType {
2285
2475
  */
2286
2476
  const Telemetry = new Telemetry$Type();
2287
2477
  // @generated message type with reflection information, may provide speed optimized methods
2478
+ class SendMetricsRequest$Type extends MessageType {
2479
+ constructor() {
2480
+ super('stream.video.sfu.signal.SendMetricsRequest', [
2481
+ { no: 1, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
2482
+ {
2483
+ no: 2,
2484
+ name: 'unified_session_id',
2485
+ kind: 'scalar',
2486
+ T: 9 /*ScalarType.STRING*/,
2487
+ },
2488
+ {
2489
+ no: 3,
2490
+ name: 'inbounds',
2491
+ kind: 'message',
2492
+ repeat: 2 /*RepeatType.UNPACKED*/,
2493
+ T: () => InboundRtp,
2494
+ },
2495
+ {
2496
+ no: 4,
2497
+ name: 'outbounds',
2498
+ kind: 'message',
2499
+ repeat: 2 /*RepeatType.UNPACKED*/,
2500
+ T: () => OutboundRtp,
2501
+ },
2502
+ {
2503
+ no: 5,
2504
+ name: 'remote_inbounds',
2505
+ kind: 'message',
2506
+ repeat: 2 /*RepeatType.UNPACKED*/,
2507
+ T: () => RemoteInboundRtp,
2508
+ },
2509
+ {
2510
+ no: 6,
2511
+ name: 'remote_outbounds',
2512
+ kind: 'message',
2513
+ repeat: 2 /*RepeatType.UNPACKED*/,
2514
+ T: () => RemoteOutboundRtp,
2515
+ },
2516
+ ]);
2517
+ }
2518
+ }
2519
+ /**
2520
+ * @generated MessageType for protobuf message stream.video.sfu.signal.SendMetricsRequest
2521
+ */
2522
+ const SendMetricsRequest = new SendMetricsRequest$Type();
2523
+ // @generated message type with reflection information, may provide speed optimized methods
2524
+ class SendMetricsResponse$Type extends MessageType {
2525
+ constructor() {
2526
+ super('stream.video.sfu.signal.SendMetricsResponse', []);
2527
+ }
2528
+ }
2529
+ /**
2530
+ * @generated MessageType for protobuf message stream.video.sfu.signal.SendMetricsResponse
2531
+ */
2532
+ const SendMetricsResponse = new SendMetricsResponse$Type();
2533
+ // @generated message type with reflection information, may provide speed optimized methods
2288
2534
  class SendStatsRequest$Type extends MessageType {
2289
2535
  constructor() {
2290
2536
  super('stream.video.sfu.signal.SendStatsRequest', [
@@ -2558,6 +2804,12 @@ class SendAnswerRequest$Type extends MessageType {
2558
2804
  },
2559
2805
  { no: 2, name: 'sdp', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
2560
2806
  { no: 3, name: 'session_id', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
2807
+ {
2808
+ no: 4,
2809
+ name: 'negotiation_id',
2810
+ kind: 'scalar',
2811
+ T: 13 /*ScalarType.UINT32*/,
2812
+ },
2561
2813
  ]);
2562
2814
  }
2563
2815
  }
@@ -2665,6 +2917,12 @@ const SignalServer = new ServiceType('stream.video.sfu.signal.SignalServer', [
2665
2917
  I: SendStatsRequest,
2666
2918
  O: SendStatsResponse,
2667
2919
  },
2920
+ {
2921
+ name: 'SendMetrics',
2922
+ options: {},
2923
+ I: SendMetricsRequest,
2924
+ O: SendMetricsResponse,
2925
+ },
2668
2926
  {
2669
2927
  name: 'StartNoiseCancellation',
2670
2928
  options: {},
@@ -3345,6 +3603,12 @@ class SubscriberOffer$Type extends MessageType {
3345
3603
  super('stream.video.sfu.event.SubscriberOffer', [
3346
3604
  { no: 1, name: 'ice_restart', kind: 'scalar', T: 8 /*ScalarType.BOOL*/ },
3347
3605
  { no: 2, name: 'sdp', kind: 'scalar', T: 9 /*ScalarType.STRING*/ },
3606
+ {
3607
+ no: 3,
3608
+ name: 'negotiation_id',
3609
+ kind: 'scalar',
3610
+ T: 13 /*ScalarType.UINT32*/,
3611
+ },
3348
3612
  ]);
3349
3613
  }
3350
3614
  }
@@ -3803,18 +4067,25 @@ class SignalServerClient {
3803
4067
  const method = this.methods[6], opt = this._transport.mergeOptions(options);
3804
4068
  return stackIntercept('unary', this._transport, method, opt, input);
3805
4069
  }
4070
+ /**
4071
+ * @generated from protobuf rpc: SendMetrics(stream.video.sfu.signal.SendMetricsRequest) returns (stream.video.sfu.signal.SendMetricsResponse);
4072
+ */
4073
+ sendMetrics(input, options) {
4074
+ const method = this.methods[7], opt = this._transport.mergeOptions(options);
4075
+ return stackIntercept('unary', this._transport, method, opt, input);
4076
+ }
3806
4077
  /**
3807
4078
  * @generated from protobuf rpc: StartNoiseCancellation(stream.video.sfu.signal.StartNoiseCancellationRequest) returns (stream.video.sfu.signal.StartNoiseCancellationResponse);
3808
4079
  */
3809
4080
  startNoiseCancellation(input, options) {
3810
- const method = this.methods[7], opt = this._transport.mergeOptions(options);
4081
+ const method = this.methods[8], opt = this._transport.mergeOptions(options);
3811
4082
  return stackIntercept('unary', this._transport, method, opt, input);
3812
4083
  }
3813
4084
  /**
3814
4085
  * @generated from protobuf rpc: StopNoiseCancellation(stream.video.sfu.signal.StopNoiseCancellationRequest) returns (stream.video.sfu.signal.StopNoiseCancellationResponse);
3815
4086
  */
3816
4087
  stopNoiseCancellation(input, options) {
3817
- const method = this.methods[8], opt = this._transport.mergeOptions(options);
4088
+ const method = this.methods[9], opt = this._transport.mergeOptions(options);
3818
4089
  return stackIntercept('unary', this._transport, method, opt, input);
3819
4090
  }
3820
4091
  }
@@ -4994,6 +5265,16 @@ const hasScreenShareAudio = (p) => p.publishedTracks.includes(TrackType.SCREEN_S
4994
5265
  * @param p the participant.
4995
5266
  */
4996
5267
  const isPinned = (p) => !!p.pin && (p.pin.isLocalPin || p.pin.pinnedAt > 0);
5268
+ /**
5269
+ * Check if a participant has a track that is currently interrupted: the
5270
+ * participant intends to publish it (it is in `publishedTracks`) but no
5271
+ * media is flowing right now (it is in `interruptedTracks`).
5272
+ *
5273
+ * @param p the participant to check.
5274
+ * @param trackType the track type to check.
5275
+ */
5276
+ const hasInterruptedTrack = (p, trackType) => !!p.interruptedTracks?.includes(trackType) &&
5277
+ p.publishedTracks.includes(trackType);
4997
5278
  /**
4998
5279
  * Check if a participant has a paused track of the specified type.
4999
5280
  *
@@ -6359,7 +6640,7 @@ const getSdkVersion = (sdk) => {
6359
6640
  return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
6360
6641
  };
6361
6642
 
6362
- const version = "1.51.0";
6643
+ const version = "1.52.0";
6363
6644
  const [major, minor, patch] = version.split('.');
6364
6645
  let sdkInfo = {
6365
6646
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -6457,6 +6738,7 @@ const getClientDetails = async () => {
6457
6738
  sdk: sdkInfo,
6458
6739
  os: osInfo,
6459
6740
  device: deviceInfo,
6741
+ webrtcVersion: webRtcInfo?.version || '',
6460
6742
  };
6461
6743
  }
6462
6744
  // @ts-expect-error - userAgentData is not yet in the TS types
@@ -6484,11 +6766,12 @@ const getClientDetails = async () => {
6484
6766
  // Eliminates the generic "Chromium" name and "Not)A_Brand" name from the list.
6485
6767
  // https://wicg.github.io/ua-client-hints/#create-arbitrary-brands-section
6486
6768
  const uaBrowser = userAgentData?.fullVersionList?.find((v) => !v.brand.includes('Chromium') && !v.brand.match(/[()\-./:;=?_]/g));
6769
+ const browserVersion = uaBrowser?.version || browser.version || '';
6487
6770
  return {
6488
6771
  sdk: sdkInfo,
6489
6772
  browser: {
6490
6773
  name: uaBrowser?.brand || browser.name || navigator.userAgent,
6491
- version: uaBrowser?.version || browser.version || '',
6774
+ version: browserVersion,
6492
6775
  },
6493
6776
  os: {
6494
6777
  name: userAgentData?.platform || os.name || '',
@@ -6501,6 +6784,7 @@ const getClientDetails = async () => {
6501
6784
  .join(' '),
6502
6785
  version: '',
6503
6786
  },
6787
+ webrtcVersion: browserVersion,
6504
6788
  };
6505
6789
  };
6506
6790
 
@@ -7164,7 +7448,7 @@ class StatsTracer {
7164
7448
  /**
7165
7449
  * Creates a new StatsTracer instance.
7166
7450
  */
7167
- constructor(pc, peerType, trackIdToTrackType) {
7451
+ constructor(pc, peerType, trackIdToTrackType, statsTimestampDriftThresholdMs = 0) {
7168
7452
  this.previousStats = {};
7169
7453
  this.frameTimeHistory = [];
7170
7454
  this.fpsHistory = [];
@@ -7178,7 +7462,7 @@ class StatsTracer {
7178
7462
  */
7179
7463
  this.get = async () => {
7180
7464
  const stats = await this.pc.getStats();
7181
- const currentStats = toObject(stats);
7465
+ const currentStats = toObjectWithCorrectedTimestamp(stats, Date.now(), this.driftThresholdMs);
7182
7466
  const performanceStats = this.withOverrides(this.peerType === PeerType.SUBSCRIBER
7183
7467
  ? this.getDecodeStats(currentStats)
7184
7468
  : this.getEncodeStats(currentStats));
@@ -7297,17 +7581,28 @@ class StatsTracer {
7297
7581
  this.pc = pc;
7298
7582
  this.peerType = peerType;
7299
7583
  this.trackIdToTrackType = trackIdToTrackType;
7584
+ this.driftThresholdMs = statsTimestampDriftThresholdMs;
7300
7585
  }
7301
7586
  }
7302
7587
  /**
7303
- * Convert the stat report to an object.
7588
+ * Convert the stat report to an object, correcting clock drift along the way.
7589
+ * Entries whose `timestamp` differs from `wallNow` by more than `thresholdMs`
7590
+ * are replaced with a clone whose `timestamp` is set to `wallNow`. The platform
7591
+ * clock backing `DOMHighResTimeStamp` can desynchronise from `Date.now()` after
7592
+ * system sleep or clock-jump events (notably on Electron/Chromium), which
7593
+ * corrupts the delta-compressed stats payload. A non-positive `thresholdMs`
7594
+ * disables correction.
7304
7595
  *
7305
7596
  * @param report the stat report to convert.
7597
+ * @param wallNow current wall-clock time used as the drift reference.
7598
+ * @param thresholdMs maximum tolerated drift in milliseconds.
7306
7599
  */
7307
- const toObject = (report) => {
7600
+ const toObjectWithCorrectedTimestamp = (report, wallNow, thresholdMs) => {
7308
7601
  const obj = {};
7602
+ const correct = thresholdMs > 0;
7309
7603
  report.forEach((v, k) => {
7310
- obj[k] = v;
7604
+ const drift = Math.abs(v.timestamp - wallNow);
7605
+ obj[k] = correct && drift > thresholdMs ? { ...v, timestamp: wallNow } : v;
7311
7606
  });
7312
7607
  return obj;
7313
7608
  };
@@ -7439,7 +7734,7 @@ class BasePeerConnection {
7439
7734
  /**
7440
7735
  * Constructs a new `BasePeerConnection` instance.
7441
7736
  */
7442
- constructor(peerType, { sfuClient, connectionConfig, state, dispatcher, onReconnectionNeeded, onIceConnected, tag, enableTracing, clientPublishOptions, iceRestartDelay = 2500, }) {
7737
+ constructor(peerType, { sfuClient, connectionConfig, state, dispatcher, onReconnectionNeeded, onIceConnected, tag, enableTracing, clientPublishOptions, iceRestartDelay = 2500, statsTimestampDriftThresholdMs = 0, }) {
7443
7738
  this.iceHasEverConnected = false;
7444
7739
  this.isIceRestarting = false;
7445
7740
  this.isDisposed = false;
@@ -7733,7 +8028,7 @@ class BasePeerConnection {
7733
8028
  this.onIceConnected = onIceConnected;
7734
8029
  this.logger = videoLoggerSystem.getLogger(peerType === PeerType.SUBSCRIBER ? 'Subscriber' : 'Publisher', { tags: [tag] });
7735
8030
  this.pc = this.createPeerConnection(connectionConfig);
7736
- this.stats = new StatsTracer(this.pc, peerType, this.trackIdToTrackType);
8031
+ this.stats = new StatsTracer(this.pc, peerType, this.trackIdToTrackType, statsTimestampDriftThresholdMs);
7737
8032
  if (enableTracing) {
7738
8033
  this.tracer = new Tracer(`${tag}-${peerType === PeerType.SUBSCRIBER ? 'sub' : 'pub'}`);
7739
8034
  this.tracer.trace('create', {
@@ -8819,6 +9114,7 @@ class Subscriber extends BasePeerConnection {
8819
9114
  await this.sfuClient.sendAnswer({
8820
9115
  peerType: PeerType.SUBSCRIBER,
8821
9116
  sdp: answer.sdp || '',
9117
+ negotiationId: subscriberOffer.negotiationId,
8822
9118
  });
8823
9119
  this.isIceRestarting = false;
8824
9120
  };
@@ -14364,7 +14660,7 @@ class Call {
14364
14660
  */
14365
14661
  this.initPublisherAndSubscriber = async (opts) => {
14366
14662
  const { sfuClient, connectionConfig, clientDetails, statsOptions, publishOptions, closePreviousInstances, unifiedSessionId, } = opts;
14367
- const { enable_rtc_stats: enableTracing } = statsOptions;
14663
+ const { enable_rtc_stats: enableTracing, reporting_interval_ms: reportingIntervalMs, } = statsOptions;
14368
14664
  if (closePreviousInstances && this.subscriber) {
14369
14665
  await this.subscriber.dispose();
14370
14666
  }
@@ -14375,6 +14671,7 @@ class Call {
14375
14671
  connectionConfig,
14376
14672
  tag: sfuClient.tag,
14377
14673
  enableTracing,
14674
+ statsTimestampDriftThresholdMs: reportingIntervalMs / 2,
14378
14675
  clientPublishOptions: this.clientPublishOptions,
14379
14676
  onReconnectionNeeded: (kind, reason, peerType) => {
14380
14677
  this.reconnect(kind, reason).catch((err) => {
@@ -17018,7 +17315,7 @@ class StreamClient {
17018
17315
  this.getUserAgent = () => {
17019
17316
  if (!this.cachedUserAgent) {
17020
17317
  const { clientAppIdentifier = {} } = this.options;
17021
- const { sdkName = 'js', sdkVersion = "1.51.0", ...extras } = clientAppIdentifier;
17318
+ const { sdkName = 'js', sdkVersion = "1.52.0", ...extras } = clientAppIdentifier;
17022
17319
  this.cachedUserAgent = [
17023
17320
  `stream-video-${sdkName}-v${sdkVersion}`,
17024
17321
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
@@ -17654,5 +17951,5 @@ const humanize = (n) => {
17654
17951
  return String(n);
17655
17952
  };
17656
17953
 
17657
- export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallRecordingFailedEventRecordingTypeEnum, CallRecordingReadyEventRecordingTypeEnum, CallRecordingStartedEventRecordingTypeEnum, CallRecordingStoppedEventRecordingTypeEnum, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DeviceManager, DeviceManagerState, DynascaleManager, ErrorFromResponse, FrameRecordingSettingsRequestModeEnum, FrameRecordingSettingsRequestQualityEnum, FrameRecordingSettingsResponseModeEnum, IndividualRecordingSettingsRequestModeEnum, IndividualRecordingSettingsResponseModeEnum, IngressAudioEncodingOptionsRequestChannelsEnum, IngressSourceRequestFpsEnum, IngressVideoLayerRequestCodecEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RawRecordingSettingsRequestModeEnum, RawRecordingSettingsResponseModeEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, SfuJoinError, models as SfuModels, SpeakerManager, SpeakerState, StartClosedCaptionsRequestLanguageEnum, StartTranscriptionRequestLanguageEnum, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestClosedCaptionModeEnum, TranscriptionSettingsRequestLanguageEnum, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseClosedCaptionModeEnum, TranscriptionSettingsResponseLanguageEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceState, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio$1 as hasAudio, hasPausedTrack, hasScreenShare, hasScreenShareAudio, hasVideo, humanize, isPinned, livestreamOrAudioRoomSortPreset, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, resolveDeviceId, role, screenSharing, setDeviceInfo, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking, videoLoggerSystem, withParticipantSource };
17954
+ export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallRecordingFailedEventRecordingTypeEnum, CallRecordingReadyEventRecordingTypeEnum, CallRecordingStartedEventRecordingTypeEnum, CallRecordingStoppedEventRecordingTypeEnum, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DeviceManager, DeviceManagerState, DynascaleManager, ErrorFromResponse, FrameRecordingSettingsRequestModeEnum, FrameRecordingSettingsRequestQualityEnum, FrameRecordingSettingsResponseModeEnum, IndividualRecordingSettingsRequestModeEnum, IndividualRecordingSettingsResponseModeEnum, IngressAudioEncodingOptionsRequestChannelsEnum, IngressSourceRequestFpsEnum, IngressVideoLayerRequestCodecEnum, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RawRecordingSettingsRequestModeEnum, RawRecordingSettingsResponseModeEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, SfuJoinError, models as SfuModels, SpeakerManager, SpeakerState, StartClosedCaptionsRequestLanguageEnum, StartTranscriptionRequestLanguageEnum, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestClosedCaptionModeEnum, TranscriptionSettingsRequestLanguageEnum, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseClosedCaptionModeEnum, TranscriptionSettingsResponseLanguageEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceState, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio$1 as hasAudio, hasInterruptedTrack, hasPausedTrack, hasScreenShare, hasScreenShareAudio, hasVideo, humanize, isPinned, livestreamOrAudioRoomSortPreset, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, resolveDeviceId, role, screenSharing, setDeviceInfo, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking, videoLoggerSystem, withParticipantSource };
17658
17955
  //# sourceMappingURL=index.browser.es.js.map