@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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [0.6.2](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.6.1...@stream-io/video-client-0.6.2) (2024-03-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * **call:** Add getCallStats method ([#1296](https://github.com/GetStream/stream-video-js/issues/1296)) ([b64a19e](https://github.com/GetStream/stream-video-js/commit/b64a19ecd2fcc74f5f531397ed34732d55b0f815))
11
+
12
+ ### [0.6.1](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.6.0...@stream-io/video-client-0.6.1) (2024-03-13)
13
+
14
+
15
+ ### Features
16
+
17
+ * **speakers:** Participant audio output levels ([#1284](https://github.com/GetStream/stream-video-js/issues/1284)) ([63b6077](https://github.com/GetStream/stream-video-js/commit/63b607709fd65019fe320e5970aab8132053995c))
18
+
5
19
  ## [0.6.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-client-0.5.11...@stream-io/video-client-0.6.0) (2024-02-26)
6
20
 
7
21
 
@@ -5926,7 +5926,9 @@ const getClientDetails = () => {
5926
5926
  architecture: cpu.architecture || '',
5927
5927
  },
5928
5928
  device: {
5929
- name: `${device.vendor || ''} ${device.model || ''} ${device.type || ''}`,
5929
+ name: [device.vendor, device.model, device.type]
5930
+ .filter(Boolean)
5931
+ .join(' '),
5930
5932
  version: '',
5931
5933
  },
5932
5934
  };
@@ -7904,7 +7906,8 @@ class Publisher {
7904
7906
  this.onIceCandidateError = (e) => {
7905
7907
  const errorMessage = e instanceof RTCPeerConnectionIceErrorEvent &&
7906
7908
  `${e.errorCode}: ${e.errorText}`;
7907
- const logLevel = this.pc.iceConnectionState === 'connected' ? 'debug' : 'error';
7909
+ const iceState = this.pc.iceConnectionState;
7910
+ const logLevel = iceState === 'connected' || iceState === 'checking' ? 'debug' : 'warn';
7908
7911
  logger$3(logLevel, `ICE Candidate error`, errorMessage);
7909
7912
  };
7910
7913
  this.onIceConnectionStateChange = () => {
@@ -8224,7 +8227,8 @@ class Subscriber {
8224
8227
  this.onIceCandidateError = (e) => {
8225
8228
  const errorMessage = e instanceof RTCPeerConnectionIceErrorEvent &&
8226
8229
  `${e.errorCode}: ${e.errorText}`;
8227
- const logLevel = this.pc.iceConnectionState === 'connected' ? 'debug' : 'error';
8230
+ const iceState = this.pc.iceConnectionState;
8231
+ const logLevel = iceState === 'connected' || iceState === 'checking' ? 'debug' : 'warn';
8228
8232
  logger$2(logLevel, `ICE Candidate error`, errorMessage);
8229
8233
  };
8230
8234
  this.sfuClient = sfuClient;
@@ -9664,8 +9668,11 @@ class DynascaleManager {
9664
9668
  audioElement.setSinkId(deviceId);
9665
9669
  }
9666
9670
  });
9667
- const volumeSubscription = this.call.speaker.state.volume$.subscribe((volume) => {
9668
- audioElement.volume = volume;
9671
+ const volumeSubscription = combineLatest([
9672
+ this.call.speaker.state.volume$,
9673
+ participant$.pipe(distinctUntilKeyChanged('audioVolume')),
9674
+ ]).subscribe(([volume, p]) => {
9675
+ audioElement.volume = p.audioVolume ?? volume;
9669
9676
  });
9670
9677
  audioElement.autoplay = true;
9671
9678
  return () => {
@@ -11029,12 +11036,13 @@ class SpeakerState {
11029
11036
  }
11030
11037
 
11031
11038
  class SpeakerManager {
11032
- constructor() {
11039
+ constructor(call) {
11033
11040
  this.state = new SpeakerState();
11034
11041
  this.subscriptions = [];
11035
11042
  this.removeSubscriptions = () => {
11036
11043
  this.subscriptions.forEach((s) => s.unsubscribe());
11037
11044
  };
11045
+ this.call = call;
11038
11046
  if (deviceIds$ && !isReactNative()) {
11039
11047
  this.subscriptions.push(combineLatest([deviceIds$, this.state.selectedDevice$]).subscribe(([devices, deviceId]) => {
11040
11048
  if (!deviceId) {
@@ -11058,7 +11066,7 @@ class SpeakerManager {
11058
11066
  return getAudioOutputDevices();
11059
11067
  }
11060
11068
  /**
11061
- * Select device
11069
+ * Select a device.
11062
11070
  *
11063
11071
  * Note: this method is not supported in React Native
11064
11072
  *
@@ -11072,7 +11080,7 @@ class SpeakerManager {
11072
11080
  }
11073
11081
  /**
11074
11082
  * Set the volume of the audio elements
11075
- * @param volume a number between 0 and 1
11083
+ * @param volume a number between 0 and 1.
11076
11084
  *
11077
11085
  * Note: this method is not supported in React Native
11078
11086
  */
@@ -11085,6 +11093,23 @@ class SpeakerManager {
11085
11093
  }
11086
11094
  this.state.setVolume(volume);
11087
11095
  }
11096
+ /**
11097
+ * Set the volume of a participant.
11098
+ *
11099
+ * Note: this method is not supported in React Native.
11100
+ *
11101
+ * @param sessionId the participant's session id.
11102
+ * @param volume a number between 0 and 1. Set it to `undefined` to use the default volume.
11103
+ */
11104
+ setParticipantVolume(sessionId, volume) {
11105
+ if (isReactNative()) {
11106
+ throw new Error('This feature is not supported in React Native');
11107
+ }
11108
+ if (volume && (volume < 0 || volume > 1)) {
11109
+ throw new Error('Volume must be between 0 and 1, or undefined');
11110
+ }
11111
+ this.call.state.updateParticipant(sessionId, { audioVolume: volume });
11112
+ }
11088
11113
  }
11089
11114
 
11090
11115
  /**
@@ -12201,6 +12226,17 @@ class Call {
12201
12226
  }
12202
12227
  return this.streamClient.get(`${endpoint}/recordings`);
12203
12228
  };
12229
+ /**
12230
+ * Retrieve call statistics for a particular call session (historical).
12231
+ * Here `callSessionID` is mandatory.
12232
+ *
12233
+ * @param callSessionID the call session ID to retrieve statistics for.
12234
+ * @returns The call stats.
12235
+ */
12236
+ this.getCallStats = async (callSessionID) => {
12237
+ const endpoint = `${this.streamClientBasePath}/stats/${callSessionID}`;
12238
+ return this.streamClient.get(endpoint);
12239
+ };
12204
12240
  /**
12205
12241
  * Sends a custom event to all call participants.
12206
12242
  *
@@ -12329,7 +12365,7 @@ class Call {
12329
12365
  this.leaveCallHooks.add(createSubscription(this.trackSubscriptionsSubject.pipe(debounce((v) => timer(v.type)), map$1((v) => v.data)), (subscriptions) => this.sfuClient?.updateSubscriptions(subscriptions)));
12330
12366
  this.camera = new CameraManager(this);
12331
12367
  this.microphone = new MicrophoneManager(this);
12332
- this.speaker = new SpeakerManager();
12368
+ this.speaker = new SpeakerManager(this);
12333
12369
  this.screenShare = new ScreenShareManager(this);
12334
12370
  }
12335
12371
  registerEffects() {
@@ -13613,7 +13649,7 @@ const getLocationHint = async (hintUrl = HINT_URL, timeout = 2000) => {
13613
13649
  const abortController = new AbortController();
13614
13650
  const timeoutId = setTimeout(() => abortController.abort(), timeout);
13615
13651
  try {
13616
- const response = await fetch(HINT_URL, {
13652
+ const response = await fetch(hintUrl, {
13617
13653
  method: 'HEAD',
13618
13654
  signal: abortController.signal,
13619
13655
  });
@@ -13622,7 +13658,7 @@ const getLocationHint = async (hintUrl = HINT_URL, timeout = 2000) => {
13622
13658
  return awsPop.substring(0, 3); // AMS1-P2 -> AMS
13623
13659
  }
13624
13660
  catch (e) {
13625
- logger('warn', `Failed to get location hint from ${HINT_URL}`, e);
13661
+ logger('warn', `Failed to get location hint from ${hintUrl}`, e);
13626
13662
  return 'ERR';
13627
13663
  }
13628
13664
  finally {
@@ -14069,7 +14105,7 @@ class StreamClient {
14069
14105
  });
14070
14106
  };
14071
14107
  this.getUserAgent = () => {
14072
- const version = "0.6.0" ;
14108
+ const version = "0.6.2" ;
14073
14109
  return (this.userAgent ||
14074
14110
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14075
14111
  };