@stream-io/video-client 1.44.3 → 1.44.4

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
@@ -6303,7 +6303,7 @@ const getSdkVersion = (sdk) => {
6303
6303
  return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
6304
6304
  };
6305
6305
 
6306
- const version = "1.44.3";
6306
+ const version = "1.44.4";
6307
6307
  const [major, minor, patch] = version.split('.');
6308
6308
  let sdkInfo = {
6309
6309
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -10318,6 +10318,9 @@ class BrowserPermission {
10318
10318
  }
10319
10319
  setState(state) {
10320
10320
  if (this.state !== state) {
10321
+ const { tracer, queryName } = this.permission;
10322
+ const traceKey = `navigator.mediaDevices.${queryName}.permission`;
10323
+ tracer?.trace(traceKey, { previous: this.state, state });
10321
10324
  this.state = state;
10322
10325
  this.listeners.forEach((listener) => listener(state));
10323
10326
  }
@@ -10388,17 +10391,19 @@ const videoDeviceConstraints = {
10388
10391
  * Keeps track of the browser permission to use microphone. This permission also
10389
10392
  * affects an ability to enumerate audio devices.
10390
10393
  */
10391
- const getAudioBrowserPermission = lazy(() => new BrowserPermission({
10394
+ const getAudioBrowserPermission = lazy((tracer) => new BrowserPermission({
10392
10395
  constraints: audioDeviceConstraints,
10393
10396
  queryName: 'microphone',
10397
+ tracer,
10394
10398
  }));
10395
10399
  /**
10396
10400
  * Keeps track of the browser permission to use camera. This permission also
10397
10401
  * affects an ability to enumerate video devices.
10398
10402
  */
10399
- const getVideoBrowserPermission = lazy(() => new BrowserPermission({
10403
+ const getVideoBrowserPermission = lazy((tracer) => new BrowserPermission({
10400
10404
  constraints: videoDeviceConstraints,
10401
10405
  queryName: 'camera',
10406
+ tracer,
10402
10407
  }));
10403
10408
  const getDeviceChangeObserver = lazy((tracer) => {
10404
10409
  // 'addEventListener' is not available in React Native, returning
@@ -10414,7 +10419,7 @@ const getDeviceChangeObserver = lazy((tracer) => {
10414
10419
  * the observable errors.
10415
10420
  */
10416
10421
  const getAudioDevices = lazy((tracer) => {
10417
- return rxjs.merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission().asObservable()).pipe(rxjs.startWith([]), rxjs.concatMap(() => getDevices(getAudioBrowserPermission(), 'audioinput', tracer)), rxjs.shareReplay(1));
10422
+ return rxjs.merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission(tracer).asObservable()).pipe(rxjs.startWith([]), rxjs.concatMap(() => getDevices(getAudioBrowserPermission(tracer), 'audioinput', tracer)), rxjs.shareReplay(1));
10418
10423
  });
10419
10424
  /**
10420
10425
  * Prompts the user for a permission to use video devices (if not already granted
@@ -10423,7 +10428,7 @@ const getAudioDevices = lazy((tracer) => {
10423
10428
  * the observable errors.
10424
10429
  */
10425
10430
  const getVideoDevices = lazy((tracer) => {
10426
- return rxjs.merge(getDeviceChangeObserver(tracer), getVideoBrowserPermission().asObservable()).pipe(rxjs.startWith([]), rxjs.concatMap(() => getDevices(getVideoBrowserPermission(), 'videoinput', tracer)), rxjs.shareReplay(1));
10431
+ return rxjs.merge(getDeviceChangeObserver(tracer), getVideoBrowserPermission(tracer).asObservable()).pipe(rxjs.startWith([]), rxjs.concatMap(() => getDevices(getVideoBrowserPermission(tracer), 'videoinput', tracer)), rxjs.shareReplay(1));
10427
10432
  });
10428
10433
  /**
10429
10434
  * Prompts the user for a permission to use video devices (if not already granted
@@ -10432,7 +10437,7 @@ const getVideoDevices = lazy((tracer) => {
10432
10437
  * the observable errors.
10433
10438
  */
10434
10439
  const getAudioOutputDevices = lazy((tracer) => {
10435
- return rxjs.merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission().asObservable()).pipe(rxjs.startWith([]), rxjs.concatMap(() => getDevices(getAudioBrowserPermission(), 'audiooutput', tracer)), rxjs.shareReplay(1));
10440
+ return rxjs.merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission(tracer).asObservable()).pipe(rxjs.startWith([]), rxjs.concatMap(() => getDevices(getAudioBrowserPermission(tracer), 'audiooutput', tracer)), rxjs.shareReplay(1));
10436
10441
  });
10437
10442
  let getUserMediaExecId = 0;
10438
10443
  const getStream = async (constraints, tracer) => {
@@ -10498,25 +10503,21 @@ const getAudioStream = async (trackConstraints, tracer) => {
10498
10503
  },
10499
10504
  };
10500
10505
  try {
10501
- await getAudioBrowserPermission().prompt({
10506
+ await getAudioBrowserPermission(tracer).prompt({
10502
10507
  throwOnNotAllowed: true,
10503
10508
  forcePrompt: true,
10504
10509
  });
10505
10510
  return await getStream(constraints, tracer);
10506
10511
  }
10507
10512
  catch (error) {
10513
+ const logger = videoLoggerSystem.getLogger('devices');
10508
10514
  if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
10509
10515
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10510
10516
  const { deviceId, ...relaxedConstraints } = trackConstraints;
10511
- videoLoggerSystem
10512
- .getLogger('devices')
10513
- .warn('Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10517
+ logger.warn('Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10514
10518
  return getAudioStream(relaxedConstraints, tracer);
10515
10519
  }
10516
- videoLoggerSystem.getLogger('devices').error('Failed to get audio stream', {
10517
- error,
10518
- constraints,
10519
- });
10520
+ logger.error('Failed to get audio stream', { error, constraints });
10520
10521
  throw error;
10521
10522
  }
10522
10523
  };
@@ -10536,25 +10537,21 @@ const getVideoStream = async (trackConstraints, tracer) => {
10536
10537
  },
10537
10538
  };
10538
10539
  try {
10539
- await getVideoBrowserPermission().prompt({
10540
+ await getVideoBrowserPermission(tracer).prompt({
10540
10541
  throwOnNotAllowed: true,
10541
10542
  forcePrompt: true,
10542
10543
  });
10543
10544
  return await getStream(constraints, tracer);
10544
10545
  }
10545
10546
  catch (error) {
10547
+ const logger = videoLoggerSystem.getLogger('devices');
10546
10548
  if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
10547
10549
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10548
10550
  const { deviceId, ...relaxedConstraints } = trackConstraints;
10549
- videoLoggerSystem
10550
- .getLogger('devices')
10551
- .warn('Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10552
- return getVideoStream(relaxedConstraints);
10551
+ logger.warn('Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10552
+ return getVideoStream(relaxedConstraints, tracer);
10553
10553
  }
10554
- videoLoggerSystem.getLogger('devices').error('Failed to get video stream', {
10555
- error,
10556
- constraints,
10557
- });
10554
+ logger.error('Failed to get video stream', { error, constraints });
10558
10555
  throw error;
10559
10556
  }
10560
10557
  };
@@ -11325,8 +11322,8 @@ class DeviceManagerState {
11325
11322
  }
11326
11323
 
11327
11324
  class CameraManagerState extends DeviceManagerState {
11328
- constructor() {
11329
- super('stop-tracks', getVideoBrowserPermission());
11325
+ constructor(tracer) {
11326
+ super('stop-tracks', getVideoBrowserPermission(tracer));
11330
11327
  this.directionSubject = new rxjs.BehaviorSubject(undefined);
11331
11328
  /**
11332
11329
  * Observable that emits the preferred camera direction
@@ -11380,7 +11377,7 @@ class CameraManager extends DeviceManager {
11380
11377
  * @param devicePersistence the device persistence preferences to use.
11381
11378
  */
11382
11379
  constructor(call, devicePersistence) {
11383
- super(call, new CameraManagerState(), TrackType.VIDEO, devicePersistence);
11380
+ super(call, new CameraManagerState(call.tracer), TrackType.VIDEO, devicePersistence);
11384
11381
  this.targetResolution = {
11385
11382
  width: 1280,
11386
11383
  height: 720,
@@ -11591,8 +11588,8 @@ class AudioDeviceManagerState extends DeviceManagerState {
11591
11588
  }
11592
11589
 
11593
11590
  class MicrophoneManagerState extends AudioDeviceManagerState {
11594
- constructor(disableMode) {
11595
- super(disableMode, getAudioBrowserPermission(), AudioBitrateProfile.VOICE_STANDARD_UNSPECIFIED);
11591
+ constructor(disableMode, tracer) {
11592
+ super(disableMode, getAudioBrowserPermission(tracer), AudioBitrateProfile.VOICE_STANDARD_UNSPECIFIED);
11596
11593
  this.speakingWhileMutedSubject = new rxjs.BehaviorSubject(false);
11597
11594
  /**
11598
11595
  * An Observable that emits `true` if the user's microphone is muted, but they're speaking.
@@ -11932,7 +11929,7 @@ class RNSpeechDetector {
11932
11929
 
11933
11930
  class MicrophoneManager extends AudioDeviceManager {
11934
11931
  constructor(call, devicePersistence, disableMode = 'stop-tracks') {
11935
- super(call, new MicrophoneManagerState(disableMode), TrackType.AUDIO, devicePersistence);
11932
+ super(call, new MicrophoneManagerState(disableMode, call.tracer), TrackType.AUDIO, devicePersistence);
11936
11933
  this.speakingWhileMutedNotificationEnabled = true;
11937
11934
  this.soundDetectorConcurrencyTag = Symbol('soundDetectorConcurrencyTag');
11938
11935
  this.silenceThresholdMs = 5000;
@@ -12034,7 +12031,6 @@ class MicrophoneManager extends AudioDeviceManager {
12034
12031
  deviceId,
12035
12032
  label,
12036
12033
  };
12037
- console.log(event);
12038
12034
  this.call.tracer.trace('mic.capture_report', event);
12039
12035
  this.call.streamClient.dispatchEvent(event);
12040
12036
  },
@@ -15908,7 +15904,7 @@ class StreamClient {
15908
15904
  this.getUserAgent = () => {
15909
15905
  if (!this.cachedUserAgent) {
15910
15906
  const { clientAppIdentifier = {} } = this.options;
15911
- const { sdkName = 'js', sdkVersion = "1.44.3", ...extras } = clientAppIdentifier;
15907
+ const { sdkName = 'js', sdkVersion = "1.44.4", ...extras } = clientAppIdentifier;
15912
15908
  this.cachedUserAgent = [
15913
15909
  `stream-video-${sdkName}-v${sdkVersion}`,
15914
15910
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),