@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.es.js CHANGED
@@ -6284,7 +6284,7 @@ const getSdkVersion = (sdk) => {
6284
6284
  return sdk ? `${sdk.major}.${sdk.minor}.${sdk.patch}` : '0.0.0-development';
6285
6285
  };
6286
6286
 
6287
- const version = "1.44.3";
6287
+ const version = "1.44.4";
6288
6288
  const [major, minor, patch] = version.split('.');
6289
6289
  let sdkInfo = {
6290
6290
  type: SdkType.PLAIN_JAVASCRIPT,
@@ -10299,6 +10299,9 @@ class BrowserPermission {
10299
10299
  }
10300
10300
  setState(state) {
10301
10301
  if (this.state !== state) {
10302
+ const { tracer, queryName } = this.permission;
10303
+ const traceKey = `navigator.mediaDevices.${queryName}.permission`;
10304
+ tracer?.trace(traceKey, { previous: this.state, state });
10302
10305
  this.state = state;
10303
10306
  this.listeners.forEach((listener) => listener(state));
10304
10307
  }
@@ -10369,17 +10372,19 @@ const videoDeviceConstraints = {
10369
10372
  * Keeps track of the browser permission to use microphone. This permission also
10370
10373
  * affects an ability to enumerate audio devices.
10371
10374
  */
10372
- const getAudioBrowserPermission = lazy(() => new BrowserPermission({
10375
+ const getAudioBrowserPermission = lazy((tracer) => new BrowserPermission({
10373
10376
  constraints: audioDeviceConstraints,
10374
10377
  queryName: 'microphone',
10378
+ tracer,
10375
10379
  }));
10376
10380
  /**
10377
10381
  * Keeps track of the browser permission to use camera. This permission also
10378
10382
  * affects an ability to enumerate video devices.
10379
10383
  */
10380
- const getVideoBrowserPermission = lazy(() => new BrowserPermission({
10384
+ const getVideoBrowserPermission = lazy((tracer) => new BrowserPermission({
10381
10385
  constraints: videoDeviceConstraints,
10382
10386
  queryName: 'camera',
10387
+ tracer,
10383
10388
  }));
10384
10389
  const getDeviceChangeObserver = lazy((tracer) => {
10385
10390
  // 'addEventListener' is not available in React Native, returning
@@ -10395,7 +10400,7 @@ const getDeviceChangeObserver = lazy((tracer) => {
10395
10400
  * the observable errors.
10396
10401
  */
10397
10402
  const getAudioDevices = lazy((tracer) => {
10398
- return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission().asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(), 'audioinput', tracer)), shareReplay(1));
10403
+ return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission(tracer).asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(tracer), 'audioinput', tracer)), shareReplay(1));
10399
10404
  });
10400
10405
  /**
10401
10406
  * Prompts the user for a permission to use video devices (if not already granted
@@ -10404,7 +10409,7 @@ const getAudioDevices = lazy((tracer) => {
10404
10409
  * the observable errors.
10405
10410
  */
10406
10411
  const getVideoDevices = lazy((tracer) => {
10407
- return merge(getDeviceChangeObserver(tracer), getVideoBrowserPermission().asObservable()).pipe(startWith([]), concatMap(() => getDevices(getVideoBrowserPermission(), 'videoinput', tracer)), shareReplay(1));
10412
+ return merge(getDeviceChangeObserver(tracer), getVideoBrowserPermission(tracer).asObservable()).pipe(startWith([]), concatMap(() => getDevices(getVideoBrowserPermission(tracer), 'videoinput', tracer)), shareReplay(1));
10408
10413
  });
10409
10414
  /**
10410
10415
  * Prompts the user for a permission to use video devices (if not already granted
@@ -10413,7 +10418,7 @@ const getVideoDevices = lazy((tracer) => {
10413
10418
  * the observable errors.
10414
10419
  */
10415
10420
  const getAudioOutputDevices = lazy((tracer) => {
10416
- return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission().asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(), 'audiooutput', tracer)), shareReplay(1));
10421
+ return merge(getDeviceChangeObserver(tracer), getAudioBrowserPermission(tracer).asObservable()).pipe(startWith([]), concatMap(() => getDevices(getAudioBrowserPermission(tracer), 'audiooutput', tracer)), shareReplay(1));
10417
10422
  });
10418
10423
  let getUserMediaExecId = 0;
10419
10424
  const getStream = async (constraints, tracer) => {
@@ -10479,25 +10484,21 @@ const getAudioStream = async (trackConstraints, tracer) => {
10479
10484
  },
10480
10485
  };
10481
10486
  try {
10482
- await getAudioBrowserPermission().prompt({
10487
+ await getAudioBrowserPermission(tracer).prompt({
10483
10488
  throwOnNotAllowed: true,
10484
10489
  forcePrompt: true,
10485
10490
  });
10486
10491
  return await getStream(constraints, tracer);
10487
10492
  }
10488
10493
  catch (error) {
10494
+ const logger = videoLoggerSystem.getLogger('devices');
10489
10495
  if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
10490
10496
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10491
10497
  const { deviceId, ...relaxedConstraints } = trackConstraints;
10492
- videoLoggerSystem
10493
- .getLogger('devices')
10494
- .warn('Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10498
+ logger.warn('Failed to get audio stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10495
10499
  return getAudioStream(relaxedConstraints, tracer);
10496
10500
  }
10497
- videoLoggerSystem.getLogger('devices').error('Failed to get audio stream', {
10498
- error,
10499
- constraints,
10500
- });
10501
+ logger.error('Failed to get audio stream', { error, constraints });
10501
10502
  throw error;
10502
10503
  }
10503
10504
  };
@@ -10517,25 +10518,21 @@ const getVideoStream = async (trackConstraints, tracer) => {
10517
10518
  },
10518
10519
  };
10519
10520
  try {
10520
- await getVideoBrowserPermission().prompt({
10521
+ await getVideoBrowserPermission(tracer).prompt({
10521
10522
  throwOnNotAllowed: true,
10522
10523
  forcePrompt: true,
10523
10524
  });
10524
10525
  return await getStream(constraints, tracer);
10525
10526
  }
10526
10527
  catch (error) {
10528
+ const logger = videoLoggerSystem.getLogger('devices');
10527
10529
  if (isNotFoundOrOverconstrainedError(error) && trackConstraints?.deviceId) {
10528
10530
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
10529
10531
  const { deviceId, ...relaxedConstraints } = trackConstraints;
10530
- videoLoggerSystem
10531
- .getLogger('devices')
10532
- .warn('Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10533
- return getVideoStream(relaxedConstraints);
10532
+ logger.warn('Failed to get video stream, will try again with relaxed constraints', { error, constraints, relaxedConstraints });
10533
+ return getVideoStream(relaxedConstraints, tracer);
10534
10534
  }
10535
- videoLoggerSystem.getLogger('devices').error('Failed to get video stream', {
10536
- error,
10537
- constraints,
10538
- });
10535
+ logger.error('Failed to get video stream', { error, constraints });
10539
10536
  throw error;
10540
10537
  }
10541
10538
  };
@@ -11306,8 +11303,8 @@ class DeviceManagerState {
11306
11303
  }
11307
11304
 
11308
11305
  class CameraManagerState extends DeviceManagerState {
11309
- constructor() {
11310
- super('stop-tracks', getVideoBrowserPermission());
11306
+ constructor(tracer) {
11307
+ super('stop-tracks', getVideoBrowserPermission(tracer));
11311
11308
  this.directionSubject = new BehaviorSubject(undefined);
11312
11309
  /**
11313
11310
  * Observable that emits the preferred camera direction
@@ -11361,7 +11358,7 @@ class CameraManager extends DeviceManager {
11361
11358
  * @param devicePersistence the device persistence preferences to use.
11362
11359
  */
11363
11360
  constructor(call, devicePersistence) {
11364
- super(call, new CameraManagerState(), TrackType.VIDEO, devicePersistence);
11361
+ super(call, new CameraManagerState(call.tracer), TrackType.VIDEO, devicePersistence);
11365
11362
  this.targetResolution = {
11366
11363
  width: 1280,
11367
11364
  height: 720,
@@ -11572,8 +11569,8 @@ class AudioDeviceManagerState extends DeviceManagerState {
11572
11569
  }
11573
11570
 
11574
11571
  class MicrophoneManagerState extends AudioDeviceManagerState {
11575
- constructor(disableMode) {
11576
- super(disableMode, getAudioBrowserPermission(), AudioBitrateProfile.VOICE_STANDARD_UNSPECIFIED);
11572
+ constructor(disableMode, tracer) {
11573
+ super(disableMode, getAudioBrowserPermission(tracer), AudioBitrateProfile.VOICE_STANDARD_UNSPECIFIED);
11577
11574
  this.speakingWhileMutedSubject = new BehaviorSubject(false);
11578
11575
  /**
11579
11576
  * An Observable that emits `true` if the user's microphone is muted, but they're speaking.
@@ -11913,7 +11910,7 @@ class RNSpeechDetector {
11913
11910
 
11914
11911
  class MicrophoneManager extends AudioDeviceManager {
11915
11912
  constructor(call, devicePersistence, disableMode = 'stop-tracks') {
11916
- super(call, new MicrophoneManagerState(disableMode), TrackType.AUDIO, devicePersistence);
11913
+ super(call, new MicrophoneManagerState(disableMode, call.tracer), TrackType.AUDIO, devicePersistence);
11917
11914
  this.speakingWhileMutedNotificationEnabled = true;
11918
11915
  this.soundDetectorConcurrencyTag = Symbol('soundDetectorConcurrencyTag');
11919
11916
  this.silenceThresholdMs = 5000;
@@ -12015,7 +12012,6 @@ class MicrophoneManager extends AudioDeviceManager {
12015
12012
  deviceId,
12016
12013
  label,
12017
12014
  };
12018
- console.log(event);
12019
12015
  this.call.tracer.trace('mic.capture_report', event);
12020
12016
  this.call.streamClient.dispatchEvent(event);
12021
12017
  },
@@ -15889,7 +15885,7 @@ class StreamClient {
15889
15885
  this.getUserAgent = () => {
15890
15886
  if (!this.cachedUserAgent) {
15891
15887
  const { clientAppIdentifier = {} } = this.options;
15892
- const { sdkName = 'js', sdkVersion = "1.44.3", ...extras } = clientAppIdentifier;
15888
+ const { sdkName = 'js', sdkVersion = "1.44.4", ...extras } = clientAppIdentifier;
15893
15889
  this.cachedUserAgent = [
15894
15890
  `stream-video-${sdkName}-v${sdkVersion}`,
15895
15891
  ...Object.entries(extras).map(([key, value]) => `${key}=${value}`),