@stream-io/video-client 0.6.0 → 0.6.1

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,13 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ### [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)
6
+
7
+
8
+ ### Features
9
+
10
+ * **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))
11
+
5
12
  ## [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
13
 
7
14
 
@@ -9664,8 +9664,11 @@ class DynascaleManager {
9664
9664
  audioElement.setSinkId(deviceId);
9665
9665
  }
9666
9666
  });
9667
- const volumeSubscription = this.call.speaker.state.volume$.subscribe((volume) => {
9668
- audioElement.volume = volume;
9667
+ const volumeSubscription = combineLatest([
9668
+ this.call.speaker.state.volume$,
9669
+ participant$.pipe(distinctUntilKeyChanged('audioVolume')),
9670
+ ]).subscribe(([volume, p]) => {
9671
+ audioElement.volume = p.audioVolume ?? volume;
9669
9672
  });
9670
9673
  audioElement.autoplay = true;
9671
9674
  return () => {
@@ -11029,12 +11032,13 @@ class SpeakerState {
11029
11032
  }
11030
11033
 
11031
11034
  class SpeakerManager {
11032
- constructor() {
11035
+ constructor(call) {
11033
11036
  this.state = new SpeakerState();
11034
11037
  this.subscriptions = [];
11035
11038
  this.removeSubscriptions = () => {
11036
11039
  this.subscriptions.forEach((s) => s.unsubscribe());
11037
11040
  };
11041
+ this.call = call;
11038
11042
  if (deviceIds$ && !isReactNative()) {
11039
11043
  this.subscriptions.push(combineLatest([deviceIds$, this.state.selectedDevice$]).subscribe(([devices, deviceId]) => {
11040
11044
  if (!deviceId) {
@@ -11058,7 +11062,7 @@ class SpeakerManager {
11058
11062
  return getAudioOutputDevices();
11059
11063
  }
11060
11064
  /**
11061
- * Select device
11065
+ * Select a device.
11062
11066
  *
11063
11067
  * Note: this method is not supported in React Native
11064
11068
  *
@@ -11072,7 +11076,7 @@ class SpeakerManager {
11072
11076
  }
11073
11077
  /**
11074
11078
  * Set the volume of the audio elements
11075
- * @param volume a number between 0 and 1
11079
+ * @param volume a number between 0 and 1.
11076
11080
  *
11077
11081
  * Note: this method is not supported in React Native
11078
11082
  */
@@ -11085,6 +11089,23 @@ class SpeakerManager {
11085
11089
  }
11086
11090
  this.state.setVolume(volume);
11087
11091
  }
11092
+ /**
11093
+ * Set the volume of a participant.
11094
+ *
11095
+ * Note: this method is not supported in React Native.
11096
+ *
11097
+ * @param sessionId the participant's session id.
11098
+ * @param volume a number between 0 and 1. Set it to `undefined` to use the default volume.
11099
+ */
11100
+ setParticipantVolume(sessionId, volume) {
11101
+ if (isReactNative()) {
11102
+ throw new Error('This feature is not supported in React Native');
11103
+ }
11104
+ if (volume && (volume < 0 || volume > 1)) {
11105
+ throw new Error('Volume must be between 0 and 1, or undefined');
11106
+ }
11107
+ this.call.state.updateParticipant(sessionId, { audioVolume: volume });
11108
+ }
11088
11109
  }
11089
11110
 
11090
11111
  /**
@@ -12329,7 +12350,7 @@ class Call {
12329
12350
  this.leaveCallHooks.add(createSubscription(this.trackSubscriptionsSubject.pipe(debounce((v) => timer(v.type)), map$1((v) => v.data)), (subscriptions) => this.sfuClient?.updateSubscriptions(subscriptions)));
12330
12351
  this.camera = new CameraManager(this);
12331
12352
  this.microphone = new MicrophoneManager(this);
12332
- this.speaker = new SpeakerManager();
12353
+ this.speaker = new SpeakerManager(this);
12333
12354
  this.screenShare = new ScreenShareManager(this);
12334
12355
  }
12335
12356
  registerEffects() {
@@ -14069,7 +14090,7 @@ class StreamClient {
14069
14090
  });
14070
14091
  };
14071
14092
  this.getUserAgent = () => {
14072
- const version = "0.6.0" ;
14093
+ const version = "0.6.1" ;
14073
14094
  return (this.userAgent ||
14074
14095
  `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${version}`);
14075
14096
  };