@stream-io/video-client 1.17.1 → 1.18.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,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.18.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.17.1...@stream-io/video-client-1.18.0) (2025-02-26)
6
+
7
+
8
+ ### Features
9
+
10
+ * align SDK version reporting, use higher-entropy user agent data for stats ([#1696](https://github.com/GetStream/stream-video-js/issues/1696)) ([e02e8d9](https://github.com/GetStream/stream-video-js/commit/e02e8d9b3843086a3fa859a8bd31ba65ace5a7fd))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * don't implicitly mark calls as `ringing` ([#1697](https://github.com/GetStream/stream-video-js/issues/1697)) ([3429a7b](https://github.com/GetStream/stream-video-js/commit/3429a7ba52e13a43b96d2c3c28f270da111f84b2)), closes [/github.com/GetStream/stream-video-js/issues/1561#issuecomment-2662584543](https://github.com/GetStream//github.com/GetStream/stream-video-js/issues/1561/issues/issuecomment-2662584543)
16
+ * use axios version that doesnt import node specific module ([#1699](https://github.com/GetStream/stream-video-js/issues/1699)) ([414e01b](https://github.com/GetStream/stream-video-js/commit/414e01b9c7e4c4862b429e48c506673bcc228fa4))
17
+
5
18
  ## [1.17.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-1.17.0...@stream-io/video-client-1.17.1) (2025-02-19)
6
19
 
7
20
 
@@ -7463,7 +7463,7 @@ const aggregate = (stats) => {
7463
7463
  return report;
7464
7464
  };
7465
7465
 
7466
- const version = "1.17.1";
7466
+ const version = "1.18.0";
7467
7467
  const [major, minor, patch] = version.split('.');
7468
7468
  let sdkInfo = {
7469
7469
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -7484,15 +7484,9 @@ const getSdkInfo = () => {
7484
7484
  const setOSInfo = (info) => {
7485
7485
  osInfo = info;
7486
7486
  };
7487
- const getOSInfo = () => {
7488
- return osInfo;
7489
- };
7490
7487
  const setDeviceInfo = (info) => {
7491
7488
  deviceInfo = info;
7492
7489
  };
7493
- const getDeviceInfo = () => {
7494
- return deviceInfo;
7495
- };
7496
7490
  const getWebRTCInfo = () => {
7497
7491
  return webRtcInfo;
7498
7492
  };
@@ -7560,26 +7554,40 @@ const setPowerState = (powerMode) => {
7560
7554
  const getDeviceState = () => {
7561
7555
  return deviceState;
7562
7556
  };
7563
- const getClientDetails = () => {
7557
+ const getClientDetails = async () => {
7564
7558
  if (isReactNative()) {
7565
7559
  // Since RN doesn't support web, sharing browser info is not required
7566
7560
  return {
7567
- sdk: getSdkInfo(),
7568
- os: getOSInfo(),
7569
- device: getDeviceInfo(),
7561
+ sdk: sdkInfo,
7562
+ os: osInfo,
7563
+ device: deviceInfo,
7570
7564
  };
7571
7565
  }
7566
+ // @ts-expect-error - userAgentData is not yet in the TS types
7567
+ const userAgentDataApi = navigator.userAgentData;
7568
+ let userAgentData;
7569
+ if (userAgentDataApi && userAgentDataApi.getHighEntropyValues) {
7570
+ try {
7571
+ userAgentData = await userAgentDataApi.getHighEntropyValues([
7572
+ 'platform',
7573
+ 'platformVersion',
7574
+ ]);
7575
+ }
7576
+ catch (e) {
7577
+ // Ignore the error
7578
+ }
7579
+ }
7572
7580
  const userAgent = new UAParser(navigator.userAgent);
7573
7581
  const { browser, os, device, cpu } = userAgent.getResult();
7574
7582
  return {
7575
- sdk: getSdkInfo(),
7583
+ sdk: sdkInfo,
7576
7584
  browser: {
7577
7585
  name: browser.name || navigator.userAgent,
7578
7586
  version: browser.version || '',
7579
7587
  },
7580
7588
  os: {
7581
- name: os.name || '',
7582
- version: os.version || '',
7589
+ name: userAgentData?.platform || os.name || '',
7590
+ version: userAgentData?.platformVersion || os.version || '',
7583
7591
  architecture: cpu.architecture || '',
7584
7592
  },
7585
7593
  device: {
@@ -7808,8 +7816,6 @@ const globalOverrideKey = Symbol('globalOverrideKey');
7808
7816
  class DynascaleManager {
7809
7817
  /**
7810
7818
  * Creates a new DynascaleManager instance.
7811
- *
7812
- * @param call the call to manage.
7813
7819
  */
7814
7820
  constructor(callState, speaker) {
7815
7821
  /**
@@ -10447,6 +10453,7 @@ class Call {
10447
10453
  this.leaveCallHooks.forEach((hook) => hook());
10448
10454
  this.initialized = false;
10449
10455
  this.hasJoinedOnce = false;
10456
+ this.ringingSubject.next(false);
10450
10457
  this.clientStore.unregisterCall(this);
10451
10458
  this.camera.dispose();
10452
10459
  this.microphone.dispose();
@@ -10505,7 +10512,7 @@ class Call {
10505
10512
  this.state.updateFromCallResponse(response.call);
10506
10513
  this.state.setMembers(response.members);
10507
10514
  this.state.setOwnCapabilities(response.own_capabilities);
10508
- if (params?.ring || this.ringing) {
10515
+ if (params?.ring) {
10509
10516
  // the call response can indicate where the call is still ringing or not
10510
10517
  this.ringingSubject.next(true);
10511
10518
  }
@@ -10527,7 +10534,7 @@ class Call {
10527
10534
  this.state.updateFromCallResponse(response.call);
10528
10535
  this.state.setMembers(response.members);
10529
10536
  this.state.setOwnCapabilities(response.own_capabilities);
10530
- if (data?.ring || this.ringing) {
10537
+ if (data?.ring) {
10531
10538
  // the call response can indicate where the call is still ringing or not
10532
10539
  this.ringingSubject.next(true);
10533
10540
  }
@@ -10639,7 +10646,7 @@ class Call {
10639
10646
  : previousSfuClient;
10640
10647
  this.sfuClient = sfuClient;
10641
10648
  this.dynascaleManager.setSfuClient(sfuClient);
10642
- const clientDetails = getClientDetails();
10649
+ const clientDetails = await getClientDetails();
10643
10650
  // we don't need to send JoinRequest if we are re-using an existing healthy SFU client
10644
10651
  if (previousSfuClient !== sfuClient) {
10645
10652
  // prepare a generic SDP and send it to the SFU.
@@ -10898,7 +10905,7 @@ class Call {
10898
10905
  this.state.updateFromCallResponse(joinResponse.call);
10899
10906
  this.state.setMembers(joinResponse.members);
10900
10907
  this.state.setOwnCapabilities(joinResponse.own_capabilities);
10901
- if (data?.ring && !this.ringing) {
10908
+ if (data?.ring) {
10902
10909
  this.ringingSubject.next(true);
10903
10910
  }
10904
10911
  if (this.ringing && !this.isCreatedByMe) {
@@ -11767,7 +11774,7 @@ class Call {
11767
11774
  * @param custom Custom data
11768
11775
  */
11769
11776
  this.submitFeedback = async (rating, { reason, custom, } = {}) => {
11770
- const { sdkName, sdkVersion, ...platform } = getSdkSignature(getClientDetails());
11777
+ const { sdkName, sdkVersion, ...platform } = getSdkSignature(await getClientDetails());
11771
11778
  return this.streamClient.post(`${this.streamClientBasePath}/feedback`, {
11772
11779
  rating,
11773
11780
  reason,
@@ -12453,7 +12460,7 @@ class StableWSConnection {
12453
12460
  }
12454
12461
  }
12455
12462
  catch (err) {
12456
- await this.client._setupConnectionIdPromise();
12463
+ this.client._setupConnectionIdPromise();
12457
12464
  this.isConnecting = false;
12458
12465
  // @ts-ignore
12459
12466
  this._log(`_connect() - Error - `, err);
@@ -12766,8 +12773,7 @@ class StreamClient {
12766
12773
  if (this.userID) {
12767
12774
  throw new Error('Use client.disconnect() before trying to connect as a different user. connectUser was called twice.');
12768
12775
  }
12769
- if ((this._isUsingServerAuth() || this.node) &&
12770
- !this.options.allowServerSideConnect) {
12776
+ if ((this.secret || this.node) && !this.options.allowServerSideConnect) {
12771
12777
  this.logger('warn', 'Please do not use connectUser server side. Use our @stream-io/node-sdk instead: https://getstream.io/video/docs/api/');
12772
12778
  }
12773
12779
  // we generate the client id client side
@@ -12835,7 +12841,7 @@ class StreamClient {
12835
12841
  this.logger('info', 'client:openConnection() - openConnection called twice, healthy connection already exists');
12836
12842
  return;
12837
12843
  }
12838
- await this._setupConnectionIdPromise();
12844
+ this._setupConnectionIdPromise();
12839
12845
  this.clientID = `${this.userID}--${randomId()}`;
12840
12846
  const newWsPromise = this.connect();
12841
12847
  this.wsPromiseSafe = makeSafePromise(newWsPromise);
@@ -12872,7 +12878,7 @@ class StreamClient {
12872
12878
  */
12873
12879
  this.connectAnonymousUser = async (user, tokenOrProvider) => {
12874
12880
  addConnectionEventListeners(this.updateNetworkConnectionStatus);
12875
- await this._setupConnectionIdPromise();
12881
+ this._setupConnectionIdPromise();
12876
12882
  this.anonymous = true;
12877
12883
  await this._setToken(user, tokenOrProvider, this.anonymous);
12878
12884
  this._setUser(user);
@@ -12922,12 +12928,16 @@ class StreamClient {
12922
12928
  }));
12923
12929
  };
12924
12930
  this._logApiRequest = (type, url, data, config) => {
12931
+ if (getLogLevel() !== 'trace')
12932
+ return;
12925
12933
  this.logger('trace', `client: ${type} - Request - ${url}`, {
12926
12934
  payload: data,
12927
12935
  config,
12928
12936
  });
12929
12937
  };
12930
12938
  this._logApiResponse = (type, url, response) => {
12939
+ if (getLogLevel() !== 'trace')
12940
+ return;
12931
12941
  this.logger('trace', `client:${type} - Response - url: ${url} > status ${response.status}`, {
12932
12942
  response,
12933
12943
  });
@@ -13076,17 +13086,17 @@ class StreamClient {
13076
13086
  return await this.wsConnection.connect(this.defaultWSTimeout);
13077
13087
  };
13078
13088
  this.getUserAgent = () => {
13079
- const version = "1.17.1";
13080
- return (this.userAgent ||
13081
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
13082
- };
13083
- this.setUserAgent = (userAgent) => {
13084
- this.userAgent = userAgent;
13089
+ if (!this.cachedUserAgent) {
13090
+ const { clientAppIdentifier = {} } = this.options;
13091
+ const { sdkName = 'js', sdkVersion = "1.18.0", ...extras } = clientAppIdentifier;
13092
+ this.cachedUserAgent = [
13093
+ `stream-video-${sdkName}-v${sdkVersion}`,
13094
+ ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),
13095
+ `client_bundle=${"browser-esm"}`,
13096
+ ].join('|');
13097
+ }
13098
+ return this.cachedUserAgent;
13085
13099
  };
13086
- /**
13087
- * _isUsingServerAuth - Returns true if we're using server side auth
13088
- */
13089
- this._isUsingServerAuth = () => !!this.secret;
13090
13100
  this._enrichAxiosOptions = (options = {
13091
13101
  params: {},
13092
13102
  headers: {},
@@ -13199,24 +13209,32 @@ class StreamClient {
13199
13209
  const getInstanceKey = (apiKey, user) => {
13200
13210
  return `${apiKey}/${user.id}`;
13201
13211
  };
13212
+ /**
13213
+ * Utility function to get the client app identifier.
13214
+ */
13215
+ const getClientAppIdentifier = (options) => {
13216
+ const appId = options?.clientAppIdentifier || {};
13217
+ const sdkInfo = getSdkInfo();
13218
+ if (sdkInfo) {
13219
+ // ensure the sdk name and version are set correctly,
13220
+ // overriding any user-provided values
13221
+ appId.sdkName = SdkType[sdkInfo.type].toLowerCase();
13222
+ appId.sdkVersion = `${sdkInfo.major}.${sdkInfo.minor}.${sdkInfo.patch}`;
13223
+ }
13224
+ return appId;
13225
+ };
13202
13226
  /**
13203
13227
  * Creates a coordinator client.
13204
13228
  */
13205
13229
  const createCoordinatorClient = (apiKey, options) => {
13230
+ const clientAppIdentifier = getClientAppIdentifier(options);
13206
13231
  const coordinatorLogger = getLogger(['coordinator']);
13207
- const streamClient = new StreamClient(apiKey, {
13232
+ return new StreamClient(apiKey, {
13208
13233
  persistUserOnConnectionFailure: true,
13209
13234
  ...options,
13235
+ clientAppIdentifier,
13210
13236
  logger: coordinatorLogger,
13211
13237
  });
13212
- const sdkInfo = getSdkInfo();
13213
- if (sdkInfo) {
13214
- const sdkName = SdkType[sdkInfo.type].toLowerCase();
13215
- const sdkVersion = `${sdkInfo.major}.${sdkInfo.minor}.${sdkInfo.patch}`;
13216
- const userAgent = streamClient.getUserAgent();
13217
- streamClient.setUserAgent(`${userAgent}-video-${sdkName}-sdk-${sdkVersion}`);
13218
- }
13219
- return streamClient;
13220
13238
  };
13221
13239
  /**
13222
13240
  * Creates a token provider and allows integrators to provide
@@ -13583,5 +13601,5 @@ class StreamVideoClient {
13583
13601
  }
13584
13602
  StreamVideoClient._instances = new Map();
13585
13603
 
13586
- export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, FrameRecordingSettingsRequestModeEnum, FrameRecordingSettingsResponseModeEnum, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, 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, 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 };
13604
+ export { AudioSettingsRequestDefaultDeviceEnum, AudioSettingsResponseDefaultDeviceEnum, browsers as Browsers, Call, CallState, CallType, CallTypes, CallingState, CameraManager, CameraManagerState, CreateDeviceRequestPushProviderEnum, DebounceType, DynascaleManager, ErrorFromResponse, FrameRecordingSettingsRequestModeEnum, FrameRecordingSettingsResponseModeEnum, InputMediaDeviceManager, InputMediaDeviceManagerState, LayoutSettingsRequestNameEnum, MicrophoneManager, MicrophoneManagerState, NoiseCancellationSettingsModeEnum, OwnCapability, RTMPBroadcastRequestQualityEnum, RTMPSettingsRequestQualityEnum, RecordSettingsRequestModeEnum, RecordSettingsRequestQualityEnum, rxUtils as RxUtils, ScreenShareManager, ScreenShareState, events as SfuEvents, models as SfuModels, SpeakerManager, SpeakerState, 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, getLogLevel, getLogger, 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 };
13587
13605
  //# sourceMappingURL=index.browser.es.js.map