@stream-io/video-client 1.12.3 → 1.13.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 CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.13.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.12.4...@stream-io/video-client-1.13.0) (2024-12-20)
6
+
7
+
8
+ ### Features
9
+
10
+ * report low power mode and thermal info to stats ([#1583](https://github.com/GetStream/stream-video-js/issues/1583)) ([ef49cee](https://github.com/GetStream/stream-video-js/commit/ef49ceef032fc3e4bb055fbc32c2b5b18c3a24d2))
11
+
12
+ ## [1.12.4](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.12.3...@stream-io/video-client-1.12.4) (2024-12-17)
13
+
14
+
15
+ * improve test coverage reporting ([#1624](https://github.com/GetStream/stream-video-js/issues/1624)) ([32bb870](https://github.com/GetStream/stream-video-js/commit/32bb870187f0627c32d2b5692ce3de633d743582))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * adjust dynascale debouncing for upscaling and downscaling ([#1621](https://github.com/GetStream/stream-video-js/issues/1621)) [skip ci] ([7b3a721](https://github.com/GetStream/stream-video-js/commit/7b3a72192fab79d8af8d1c392a9f0135e2d25b16))
21
+ * prevent auto-dropping already accepted or rejected calls ([#1619](https://github.com/GetStream/stream-video-js/issues/1619)) ([113406a](https://github.com/GetStream/stream-video-js/commit/113406a9ba7fdf2e193a1933b73963e0011f28f0))
22
+
5
23
  ## [1.12.3](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.12.2...@stream-io/video-client-1.12.3) (2024-12-13)
6
24
 
7
25
 
@@ -3299,7 +3299,7 @@ const retryable = async (rpc, signal) => {
3299
3299
  return result;
3300
3300
  };
3301
3301
 
3302
- const version = "1.12.3";
3302
+ const version = "1.13.0";
3303
3303
  const [major, minor, patch] = version.split('.');
3304
3304
  let sdkInfo = {
3305
3305
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -3310,6 +3310,7 @@ let sdkInfo = {
3310
3310
  let osInfo;
3311
3311
  let deviceInfo;
3312
3312
  let webRtcInfo;
3313
+ let deviceState;
3313
3314
  const setSdkInfo = (info) => {
3314
3315
  sdkInfo = info;
3315
3316
  };
@@ -3334,6 +3335,67 @@ const getWebRTCInfo = () => {
3334
3335
  const setWebRTCInfo = (info) => {
3335
3336
  webRtcInfo = info;
3336
3337
  };
3338
+ const setThermalState = (state) => {
3339
+ if (!osInfo) {
3340
+ deviceState = { oneofKind: undefined };
3341
+ return;
3342
+ }
3343
+ if (osInfo.name === 'android') {
3344
+ const thermalState = AndroidThermalState[state] ||
3345
+ AndroidThermalState.UNSPECIFIED;
3346
+ deviceState = {
3347
+ oneofKind: 'android',
3348
+ android: {
3349
+ thermalState,
3350
+ isPowerSaverMode: deviceState?.oneofKind === 'android' &&
3351
+ deviceState.android.isPowerSaverMode,
3352
+ },
3353
+ };
3354
+ }
3355
+ if (osInfo.name.toLowerCase() === 'ios') {
3356
+ const thermalState = AppleThermalState[state] ||
3357
+ AppleThermalState.UNSPECIFIED;
3358
+ deviceState = {
3359
+ oneofKind: 'apple',
3360
+ apple: {
3361
+ thermalState,
3362
+ isLowPowerModeEnabled: deviceState?.oneofKind === 'apple' &&
3363
+ deviceState.apple.isLowPowerModeEnabled,
3364
+ },
3365
+ };
3366
+ }
3367
+ };
3368
+ const setPowerState = (powerMode) => {
3369
+ if (!osInfo) {
3370
+ deviceState = { oneofKind: undefined };
3371
+ return;
3372
+ }
3373
+ if (osInfo.name === 'android') {
3374
+ deviceState = {
3375
+ oneofKind: 'android',
3376
+ android: {
3377
+ thermalState: deviceState?.oneofKind === 'android'
3378
+ ? deviceState.android.thermalState
3379
+ : AndroidThermalState.UNSPECIFIED,
3380
+ isPowerSaverMode: powerMode,
3381
+ },
3382
+ };
3383
+ }
3384
+ if (osInfo.name.toLowerCase() === 'ios') {
3385
+ deviceState = {
3386
+ oneofKind: 'apple',
3387
+ apple: {
3388
+ thermalState: deviceState?.oneofKind === 'apple'
3389
+ ? deviceState.apple.thermalState
3390
+ : AppleThermalState.UNSPECIFIED,
3391
+ isLowPowerModeEnabled: powerMode,
3392
+ },
3393
+ };
3394
+ }
3395
+ };
3396
+ const getDeviceState = () => {
3397
+ return deviceState;
3398
+ };
3337
3399
  const getClientDetails = () => {
3338
3400
  if (isReactNative()) {
3339
3401
  // Since RN doesn't support web, sharing browser info is not required
@@ -7625,7 +7687,7 @@ class SfuStatsReporter {
7625
7687
  publisherStats,
7626
7688
  audioDevices: this.inputDevices.get('mic'),
7627
7689
  videoDevices: this.inputDevices.get('camera'),
7628
- deviceState: { oneofKind: undefined },
7690
+ deviceState: getDeviceState(),
7629
7691
  telemetry: telemetryData,
7630
7692
  });
7631
7693
  };
@@ -7955,17 +8017,27 @@ class DynascaleManager {
7955
8017
  const resizeObserver = boundParticipant.isLocalParticipant
7956
8018
  ? null
7957
8019
  : new ResizeObserver(() => {
7958
- const currentDimensions = `${videoElement.clientWidth},${videoElement.clientHeight}`;
8020
+ const currentDimensions = {
8021
+ width: videoElement.clientWidth,
8022
+ height: videoElement.clientHeight,
8023
+ };
7959
8024
  // skip initial trigger
7960
8025
  if (!lastDimensions) {
7961
8026
  lastDimensions = currentDimensions;
7962
8027
  return;
7963
8028
  }
7964
- if (lastDimensions === currentDimensions ||
8029
+ if ((lastDimensions.width === currentDimensions.width &&
8030
+ lastDimensions.height === currentDimensions.height) ||
7965
8031
  viewportVisibilityState === VisibilityState.INVISIBLE) {
7966
8032
  return;
7967
8033
  }
7968
- requestTrackWithDimensions(DebounceType.SLOW, {
8034
+ const relativeDelta = Math.max(currentDimensions.width / lastDimensions.width, currentDimensions.height / lastDimensions.height);
8035
+ // Low quality video in an upscaled video element is very noticable.
8036
+ // We try to upscale faster, and downscale slower. We also update debounce
8037
+ // more if the size change is not significant, gurading against fast-firing
8038
+ // resize events.
8039
+ const debounceType = relativeDelta > 1.2 ? DebounceType.IMMEDIATE : DebounceType.MEDIUM;
8040
+ requestTrackWithDimensions(debounceType, {
7969
8041
  width: videoElement.clientWidth,
7970
8042
  height: videoElement.clientHeight,
7971
8043
  });
@@ -7981,7 +8053,7 @@ class DynascaleManager {
7981
8053
  .subscribe((isPublishing) => {
7982
8054
  if (isPublishing) {
7983
8055
  // the participant just started to publish a track
7984
- requestTrackWithDimensions(DebounceType.FAST, {
8056
+ requestTrackWithDimensions(DebounceType.IMMEDIATE, {
7985
8057
  width: videoElement.clientWidth,
7986
8058
  height: videoElement.clientHeight,
7987
8059
  });
@@ -11261,26 +11333,35 @@ class Call {
11261
11333
  * Applicable only for ringing calls.
11262
11334
  */
11263
11335
  this.scheduleAutoDrop = () => {
11264
- clearTimeout(this.dropTimeout);
11265
- this.leaveCallHooks.add(createSubscription(this.state.settings$, (settings) => {
11266
- if (!settings)
11267
- return;
11268
- // ignore if the call is not ringing
11336
+ this.cancelAutoDrop();
11337
+ const settings = this.state.settings;
11338
+ if (!settings)
11339
+ return;
11340
+ // ignore if the call is not ringing
11341
+ if (this.state.callingState !== CallingState.RINGING)
11342
+ return;
11343
+ const timeoutInMs = this.isCreatedByMe
11344
+ ? settings.ring.auto_cancel_timeout_ms
11345
+ : settings.ring.incoming_call_timeout_ms;
11346
+ // 0 means no auto-drop
11347
+ if (timeoutInMs <= 0)
11348
+ return;
11349
+ this.dropTimeout = setTimeout(() => {
11350
+ // the call might have stopped ringing by this point,
11351
+ // e.g. it was already accepted and joined
11269
11352
  if (this.state.callingState !== CallingState.RINGING)
11270
11353
  return;
11271
- const timeoutInMs = this.isCreatedByMe
11272
- ? settings.ring.auto_cancel_timeout_ms
11273
- : settings.ring.incoming_call_timeout_ms;
11274
- // 0 means no auto-drop
11275
- if (timeoutInMs <= 0)
11276
- return;
11277
- clearTimeout(this.dropTimeout);
11278
- this.dropTimeout = setTimeout(() => {
11279
- this.leave({ reject: true, reason: 'timeout' }).catch((err) => {
11280
- this.logger('error', 'Failed to drop call', err);
11281
- });
11282
- }, timeoutInMs);
11283
- }));
11354
+ this.leave({ reject: true, reason: 'timeout' }).catch((err) => {
11355
+ this.logger('error', 'Failed to drop call', err);
11356
+ });
11357
+ }, timeoutInMs);
11358
+ };
11359
+ /**
11360
+ * Cancels a scheduled auto-drop timeout.
11361
+ */
11362
+ this.cancelAutoDrop = () => {
11363
+ clearTimeout(this.dropTimeout);
11364
+ this.dropTimeout = undefined;
11284
11365
  };
11285
11366
  /**
11286
11367
  * Retrieves the list of recordings for the current call or call session.
@@ -11616,15 +11697,17 @@ class Call {
11616
11697
  }
11617
11698
  }));
11618
11699
  this.leaveCallHooks.add(
11619
- // watch for auto drop cancellation
11620
- createSubscription(this.state.callingState$, (callingState) => {
11700
+ // cancel auto-drop when call is
11701
+ createSubscription(this.state.session$, (session) => {
11621
11702
  if (!this.ringing)
11622
11703
  return;
11623
- if (callingState === CallingState.JOINED ||
11624
- callingState === CallingState.JOINING ||
11625
- callingState === CallingState.LEFT) {
11626
- clearTimeout(this.dropTimeout);
11627
- this.dropTimeout = undefined;
11704
+ const receiverId = this.clientStore.connectedUser?.id;
11705
+ if (!receiverId)
11706
+ return;
11707
+ const isAcceptedByMe = Boolean(session?.accepted_by[receiverId]);
11708
+ const isRejectedByMe = Boolean(session?.rejected_by[receiverId]);
11709
+ if (isAcceptedByMe || isRejectedByMe) {
11710
+ this.cancelAutoDrop();
11628
11711
  }
11629
11712
  }));
11630
11713
  this.leaveCallHooks.add(
@@ -12811,7 +12894,7 @@ class StreamClient {
12811
12894
  return await this.wsConnection.connect(this.defaultWSTimeout);
12812
12895
  };
12813
12896
  this.getUserAgent = () => {
12814
- const version = "1.12.3";
12897
+ const version = "1.13.0";
12815
12898
  return (this.userAgent ||
12816
12899
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12817
12900
  };
@@ -13320,5 +13403,5 @@ class StreamVideoClient {
13320
13403
  }
13321
13404
  StreamVideoClient._instanceMap = new Map();
13322
13405
 
13323
- export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, BlockListOptionsBehaviorEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, ChannelConfigWithInfoAutomodBehaviorEnum, ChannelConfigWithInfoAutomodEnum, ChannelConfigWithInfoBlocklistBehaviorEnum, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getLogLevel, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio, hasScreenShare, hasScreenShareAudio, hasVideo, isPinned, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setSdkInfo, setWebRTCInfo, speakerLayoutSortPreset, speaking };
13406
+ export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, BlockListOptionsBehaviorEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, ChannelConfigWithInfoAutomodBehaviorEnum, ChannelConfigWithInfoAutomodEnum, ChannelConfigWithInfoBlocklistBehaviorEnum, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, InputMediaDeviceManager, InputMediaDeviceManagerState, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, StreamSfuClient, StreamVideoClient, StreamVideoReadOnlyStateStore, StreamVideoWriteableStateStore, TranscriptionSettingsRequestModeEnum, TranscriptionSettingsResponseModeEnum, VideoSettingsRequestCameraFacingEnum, VideoSettingsResponseCameraFacingEnum, ViewportTracker, VisibilityState, checkIfAudioOutputChangeSupported, combineComparators, conditional, createSoundDetector, defaultSortPreset, descending, deviceIds$, disposeOfMediaStream, dominantSpeaker, getAudioBrowserPermission, getAudioDevices, getAudioOutputDevices, getAudioStream, getClientDetails, getDeviceInfo, getDeviceState, getLogLevel, getLogger, getOSInfo, getScreenShareStream, getSdkInfo, getVideoBrowserPermission, getVideoDevices, getVideoStream, getWebRTCInfo, hasAudio, hasScreenShare, hasScreenShareAudio, hasVideo, isPinned, livestreamOrAudioRoomSortPreset, logLevels, logToConsole, name, noopComparator, paginatedLayoutSortPreset, pinned, publishingAudio, publishingVideo, reactionType, role, screenSharing, setDeviceInfo, setLogLevel, setLogger, setOSInfo, setPowerState, setSdkInfo, setThermalState, setWebRTCInfo, speakerLayoutSortPreset, speaking };
13324
13407
  //# sourceMappingURL=index.browser.es.js.map