@stream-io/video-client 1.12.4 → 1.13.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/dist/index.cjs.js CHANGED
@@ -3320,7 +3320,7 @@ const retryable = async (rpc, signal) => {
3320
3320
  return result;
3321
3321
  };
3322
3322
 
3323
- const version = "1.12.4";
3323
+ const version = "1.13.1";
3324
3324
  const [major, minor, patch] = version.split('.');
3325
3325
  let sdkInfo = {
3326
3326
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -3331,6 +3331,7 @@ let sdkInfo = {
3331
3331
  let osInfo;
3332
3332
  let deviceInfo;
3333
3333
  let webRtcInfo;
3334
+ let deviceState = { oneofKind: undefined };
3334
3335
  const setSdkInfo = (info) => {
3335
3336
  sdkInfo = info;
3336
3337
  };
@@ -3355,6 +3356,67 @@ const getWebRTCInfo = () => {
3355
3356
  const setWebRTCInfo = (info) => {
3356
3357
  webRtcInfo = info;
3357
3358
  };
3359
+ const setThermalState = (state) => {
3360
+ if (!osInfo) {
3361
+ deviceState = { oneofKind: undefined };
3362
+ return;
3363
+ }
3364
+ if (osInfo.name === 'android') {
3365
+ const thermalState = AndroidThermalState[state] ||
3366
+ AndroidThermalState.UNSPECIFIED;
3367
+ deviceState = {
3368
+ oneofKind: 'android',
3369
+ android: {
3370
+ thermalState,
3371
+ isPowerSaverMode: deviceState?.oneofKind === 'android' &&
3372
+ deviceState.android.isPowerSaverMode,
3373
+ },
3374
+ };
3375
+ }
3376
+ if (osInfo.name.toLowerCase() === 'ios') {
3377
+ const thermalState = AppleThermalState[state] ||
3378
+ AppleThermalState.UNSPECIFIED;
3379
+ deviceState = {
3380
+ oneofKind: 'apple',
3381
+ apple: {
3382
+ thermalState,
3383
+ isLowPowerModeEnabled: deviceState?.oneofKind === 'apple' &&
3384
+ deviceState.apple.isLowPowerModeEnabled,
3385
+ },
3386
+ };
3387
+ }
3388
+ };
3389
+ const setPowerState = (powerMode) => {
3390
+ if (!osInfo) {
3391
+ deviceState = { oneofKind: undefined };
3392
+ return;
3393
+ }
3394
+ if (osInfo.name === 'android') {
3395
+ deviceState = {
3396
+ oneofKind: 'android',
3397
+ android: {
3398
+ thermalState: deviceState?.oneofKind === 'android'
3399
+ ? deviceState.android.thermalState
3400
+ : AndroidThermalState.UNSPECIFIED,
3401
+ isPowerSaverMode: powerMode,
3402
+ },
3403
+ };
3404
+ }
3405
+ if (osInfo.name.toLowerCase() === 'ios') {
3406
+ deviceState = {
3407
+ oneofKind: 'apple',
3408
+ apple: {
3409
+ thermalState: deviceState?.oneofKind === 'apple'
3410
+ ? deviceState.apple.thermalState
3411
+ : AppleThermalState.UNSPECIFIED,
3412
+ isLowPowerModeEnabled: powerMode,
3413
+ },
3414
+ };
3415
+ }
3416
+ };
3417
+ const getDeviceState = () => {
3418
+ return deviceState;
3419
+ };
3358
3420
  const getClientDetails = () => {
3359
3421
  if (isReactNative()) {
3360
3422
  // Since RN doesn't support web, sharing browser info is not required
@@ -7646,7 +7708,7 @@ class SfuStatsReporter {
7646
7708
  publisherStats,
7647
7709
  audioDevices: this.inputDevices.get('mic'),
7648
7710
  videoDevices: this.inputDevices.get('camera'),
7649
- deviceState: { oneofKind: undefined },
7711
+ deviceState: getDeviceState(),
7650
7712
  telemetry: telemetryData,
7651
7713
  });
7652
7714
  };
@@ -12851,7 +12913,7 @@ class StreamClient {
12851
12913
  return await this.wsConnection.connect(this.defaultWSTimeout);
12852
12914
  };
12853
12915
  this.getUserAgent = () => {
12854
- const version = "1.12.4";
12916
+ const version = "1.13.1";
12855
12917
  return (this.userAgent ||
12856
12918
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
12857
12919
  };
@@ -13419,6 +13481,7 @@ exports.getAudioOutputDevices = getAudioOutputDevices;
13419
13481
  exports.getAudioStream = getAudioStream;
13420
13482
  exports.getClientDetails = getClientDetails;
13421
13483
  exports.getDeviceInfo = getDeviceInfo;
13484
+ exports.getDeviceState = getDeviceState;
13422
13485
  exports.getLogLevel = getLogLevel;
13423
13486
  exports.getLogger = getLogger;
13424
13487
  exports.getOSInfo = getOSInfo;
@@ -13449,7 +13512,9 @@ exports.setDeviceInfo = setDeviceInfo;
13449
13512
  exports.setLogLevel = setLogLevel;
13450
13513
  exports.setLogger = setLogger;
13451
13514
  exports.setOSInfo = setOSInfo;
13515
+ exports.setPowerState = setPowerState;
13452
13516
  exports.setSdkInfo = setSdkInfo;
13517
+ exports.setThermalState = setThermalState;
13453
13518
  exports.setWebRTCInfo = setWebRTCInfo;
13454
13519
  exports.speakerLayoutSortPreset = speakerLayoutSortPreset;
13455
13520
  exports.speaking = speaking;