@stream-io/video-client 0.6.0 → 0.6.2

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
@@ -5929,7 +5929,9 @@ const getClientDetails = () => {
5929
5929
  architecture: cpu.architecture || '',
5930
5930
  },
5931
5931
  device: {
5932
- name: `${device.vendor || ''} ${device.model || ''} ${device.type || ''}`,
5932
+ name: [device.vendor, device.model, device.type]
5933
+ .filter(Boolean)
5934
+ .join(' '),
5933
5935
  version: '',
5934
5936
  },
5935
5937
  };
@@ -7907,7 +7909,8 @@ class Publisher {
7907
7909
  this.onIceCandidateError = (e) => {
7908
7910
  const errorMessage = e instanceof RTCPeerConnectionIceErrorEvent &&
7909
7911
  `${e.errorCode}: ${e.errorText}`;
7910
- const logLevel = this.pc.iceConnectionState === 'connected' ? 'debug' : 'error';
7912
+ const iceState = this.pc.iceConnectionState;
7913
+ const logLevel = iceState === 'connected' || iceState === 'checking' ? 'debug' : 'warn';
7911
7914
  logger$3(logLevel, `ICE Candidate error`, errorMessage);
7912
7915
  };
7913
7916
  this.onIceConnectionStateChange = () => {
@@ -8227,7 +8230,8 @@ class Subscriber {
8227
8230
  this.onIceCandidateError = (e) => {
8228
8231
  const errorMessage = e instanceof RTCPeerConnectionIceErrorEvent &&
8229
8232
  `${e.errorCode}: ${e.errorText}`;
8230
- const logLevel = this.pc.iceConnectionState === 'connected' ? 'debug' : 'error';
8233
+ const iceState = this.pc.iceConnectionState;
8234
+ const logLevel = iceState === 'connected' || iceState === 'checking' ? 'debug' : 'warn';
8231
8235
  logger$2(logLevel, `ICE Candidate error`, errorMessage);
8232
8236
  };
8233
8237
  this.sfuClient = sfuClient;
@@ -9667,8 +9671,11 @@ class DynascaleManager {
9667
9671
  audioElement.setSinkId(deviceId);
9668
9672
  }
9669
9673
  });
9670
- const volumeSubscription = this.call.speaker.state.volume$.subscribe((volume) => {
9671
- audioElement.volume = volume;
9674
+ const volumeSubscription = combineLatest([
9675
+ this.call.speaker.state.volume$,
9676
+ participant$.pipe(distinctUntilKeyChanged('audioVolume')),
9677
+ ]).subscribe(([volume, p]) => {
9678
+ audioElement.volume = p.audioVolume ?? volume;
9672
9679
  });
9673
9680
  audioElement.autoplay = true;
9674
9681
  return () => {
@@ -11032,12 +11039,13 @@ class SpeakerState {
11032
11039
  }
11033
11040
 
11034
11041
  class SpeakerManager {
11035
- constructor() {
11042
+ constructor(call) {
11036
11043
  this.state = new SpeakerState();
11037
11044
  this.subscriptions = [];
11038
11045
  this.removeSubscriptions = () => {
11039
11046
  this.subscriptions.forEach((s) => s.unsubscribe());
11040
11047
  };
11048
+ this.call = call;
11041
11049
  if (deviceIds$ && !isReactNative()) {
11042
11050
  this.subscriptions.push(combineLatest([deviceIds$, this.state.selectedDevice$]).subscribe(([devices, deviceId]) => {
11043
11051
  if (!deviceId) {
@@ -11061,7 +11069,7 @@ class SpeakerManager {
11061
11069
  return getAudioOutputDevices();
11062
11070
  }
11063
11071
  /**
11064
- * Select device
11072
+ * Select a device.
11065
11073
  *
11066
11074
  * Note: this method is not supported in React Native
11067
11075
  *
@@ -11075,7 +11083,7 @@ class SpeakerManager {
11075
11083
  }
11076
11084
  /**
11077
11085
  * Set the volume of the audio elements
11078
- * @param volume a number between 0 and 1
11086
+ * @param volume a number between 0 and 1.
11079
11087
  *
11080
11088
  * Note: this method is not supported in React Native
11081
11089
  */
@@ -11088,6 +11096,23 @@ class SpeakerManager {
11088
11096
  }
11089
11097
  this.state.setVolume(volume);
11090
11098
  }
11099
+ /**
11100
+ * Set the volume of a participant.
11101
+ *
11102
+ * Note: this method is not supported in React Native.
11103
+ *
11104
+ * @param sessionId the participant's session id.
11105
+ * @param volume a number between 0 and 1. Set it to `undefined` to use the default volume.
11106
+ */
11107
+ setParticipantVolume(sessionId, volume) {
11108
+ if (isReactNative()) {
11109
+ throw new Error('This feature is not supported in React Native');
11110
+ }
11111
+ if (volume && (volume < 0 || volume > 1)) {
11112
+ throw new Error('Volume must be between 0 and 1, or undefined');
11113
+ }
11114
+ this.call.state.updateParticipant(sessionId, { audioVolume: volume });
11115
+ }
11091
11116
  }
11092
11117
 
11093
11118
  /**
@@ -12204,6 +12229,17 @@ class Call {
12204
12229
  }
12205
12230
  return this.streamClient.get(`${endpoint}/recordings`);
12206
12231
  };
12232
+ /**
12233
+ * Retrieve call statistics for a particular call session (historical).
12234
+ * Here `callSessionID` is mandatory.
12235
+ *
12236
+ * @param callSessionID the call session ID to retrieve statistics for.
12237
+ * @returns The call stats.
12238
+ */
12239
+ this.getCallStats = async (callSessionID) => {
12240
+ const endpoint = `${this.streamClientBasePath}/stats/${callSessionID}`;
12241
+ return this.streamClient.get(endpoint);
12242
+ };
12207
12243
  /**
12208
12244
  * Sends a custom event to all call participants.
12209
12245
  *
@@ -12332,7 +12368,7 @@ class Call {
12332
12368
  this.leaveCallHooks.add(createSubscription(this.trackSubscriptionsSubject.pipe(debounce((v) => timer(v.type)), map$1((v) => v.data)), (subscriptions) => this.sfuClient?.updateSubscriptions(subscriptions)));
12333
12369
  this.camera = new CameraManager(this);
12334
12370
  this.microphone = new MicrophoneManager(this);
12335
- this.speaker = new SpeakerManager();
12371
+ this.speaker = new SpeakerManager(this);
12336
12372
  this.screenShare = new ScreenShareManager(this);
12337
12373
  }
12338
12374
  registerEffects() {
@@ -13617,7 +13653,7 @@ const getLocationHint = async (hintUrl = HINT_URL, timeout = 2000) => {
13617
13653
  const abortController = new AbortController();
13618
13654
  const timeoutId = setTimeout(() => abortController.abort(), timeout);
13619
13655
  try {
13620
- const response = await fetch(HINT_URL, {
13656
+ const response = await fetch(hintUrl, {
13621
13657
  method: 'HEAD',
13622
13658
  signal: abortController.signal,
13623
13659
  });
@@ -13626,7 +13662,7 @@ const getLocationHint = async (hintUrl = HINT_URL, timeout = 2000) => {
13626
13662
  return awsPop.substring(0, 3); // AMS1-P2 -> AMS
13627
13663
  }
13628
13664
  catch (e) {
13629
- logger('warn', `Failed to get location hint from ${HINT_URL}`, e);
13665
+ logger('warn', `Failed to get location hint from ${hintUrl}`, e);
13630
13666
  return 'ERR';
13631
13667
  }
13632
13668
  finally {
@@ -14073,7 +14109,7 @@ class StreamClient {
14073
14109
  });
14074
14110
  };
14075
14111
  this.getUserAgent = () => {
14076
- const version = "0.6.0" ;
14112
+ const version = "0.6.2" ;
14077
14113
  return (this.userAgent ||
14078
14114
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14079
14115
  };