@stream-io/video-client 0.3.14 → 0.3.16

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.3.16](https://github.com/GetStream/stream-video-js/compare/client0.3.15...client0.3.16) (2023-09-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * restore remote muting functionality ([#1078](https://github.com/GetStream/stream-video-js/issues/1078)) ([091d444](https://github.com/GetStream/stream-video-js/commit/091d4440a423e5f265e6fd6b1ceea32a447de93a)), closes [#1070](https://github.com/GetStream/stream-video-js/issues/1070) [#988](https://github.com/GetStream/stream-video-js/issues/988)
11
+
12
+ ### [0.3.15](https://github.com/GetStream/stream-video-js/compare/client0.3.14...client0.3.15) (2023-09-11)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * consider prior track publishing state before applying soft mutes ([#1070](https://github.com/GetStream/stream-video-js/issues/1070)) ([f542409](https://github.com/GetStream/stream-video-js/commit/f542409c641417bbbe6f0997d77e34684b881bfb)), closes [#988](https://github.com/GetStream/stream-video-js/issues/988)
18
+
5
19
  ### [0.3.14](https://github.com/GetStream/stream-video-js/compare/client0.3.13...client0.3.14) (2023-09-05)
6
20
 
7
21
 
@@ -6376,10 +6376,9 @@ class Publisher {
6376
6376
  * @param dispatcher the dispatcher to use.
6377
6377
  * @param isDtxEnabled whether DTX is enabled.
6378
6378
  * @param isRedEnabled whether RED is enabled.
6379
- * @param preferredVideoCodec the preferred video codec.
6380
6379
  * @param iceRestartDelay the delay in milliseconds to wait before restarting ICE once connection goes to `disconnected` state.
6381
6380
  */
6382
- constructor({ connectionConfig, sfuClient, dispatcher, state, isDtxEnabled, isRedEnabled, preferredVideoCodec, iceRestartDelay = 2500, }) {
6381
+ constructor({ connectionConfig, sfuClient, dispatcher, state, isDtxEnabled, isRedEnabled, iceRestartDelay = 2500, }) {
6383
6382
  this.transceiverRegistry = {
6384
6383
  [TrackType.AUDIO]: undefined,
6385
6384
  [TrackType.VIDEO]: undefined,
@@ -6879,7 +6878,6 @@ class Publisher {
6879
6878
  this.state = state;
6880
6879
  this.isDtxEnabled = isDtxEnabled;
6881
6880
  this.isRedEnabled = isRedEnabled;
6882
- this.preferredVideoCodec = preferredVideoCodec;
6883
6881
  this.iceRestartDelay = iceRestartDelay;
6884
6882
  this.unsubscribeOnIceRestart = dispatcher.on('iceRestart', (message) => __awaiter(this, void 0, void 0, function* () {
6885
6883
  if (message.eventPayload.oneofKind !== 'iceRestart')
@@ -8749,6 +8747,43 @@ const watchPinsUpdated = (state) => {
8749
8747
  };
8750
8748
  };
8751
8749
 
8750
+ /**
8751
+ * An event handler that handles soft mutes.
8752
+ *
8753
+ * @param call the call.
8754
+ */
8755
+ const handleRemoteSoftMute = (call) => {
8756
+ return call.on('trackUnpublished', (event) => __awaiter(void 0, void 0, void 0, function* () {
8757
+ var _a;
8758
+ if (event.eventPayload.oneofKind !== 'trackUnpublished')
8759
+ return;
8760
+ const { trackUnpublished: { cause, type, sessionId }, } = event.eventPayload;
8761
+ const { localParticipant } = call.state;
8762
+ if (cause === TrackUnpublishReason.MODERATION &&
8763
+ sessionId === (localParticipant === null || localParticipant === void 0 ? void 0 : localParticipant.sessionId)) {
8764
+ const logger = call.logger;
8765
+ logger('info', `Local participant's ${TrackType[type]} track is muted remotely`);
8766
+ try {
8767
+ if (type === TrackType.VIDEO) {
8768
+ yield call.camera.disable();
8769
+ }
8770
+ else if (type === TrackType.AUDIO) {
8771
+ yield call.microphone.disable();
8772
+ }
8773
+ else {
8774
+ logger('warn', 'Unsupported track type to soft mute', TrackType[type]);
8775
+ }
8776
+ if ((_a = call.publisher) === null || _a === void 0 ? void 0 : _a.isPublishing(type)) {
8777
+ yield call.stopPublish(type);
8778
+ }
8779
+ }
8780
+ catch (error) {
8781
+ logger('error', 'Failed to stop publishing', error);
8782
+ }
8783
+ }
8784
+ }));
8785
+ };
8786
+
8752
8787
  /**
8753
8788
  * An event responder which handles the `participantJoined` event.
8754
8789
  */
@@ -8898,6 +8933,7 @@ const registerEventHandlers = (call, state, dispatcher) => {
8898
8933
  watchDominantSpeakerChanged(dispatcher, state),
8899
8934
  call.on('callGrantsUpdated', watchCallGrantsUpdated(state)),
8900
8935
  call.on('pinsUpdated', watchPinsUpdated(state)),
8936
+ handleRemoteSoftMute(call),
8901
8937
  ];
8902
8938
  if (call.ringing) {
8903
8939
  // these events are only relevant when the call is ringing
@@ -9766,7 +9802,7 @@ class InputMediaDeviceManagerState {
9766
9802
  }
9767
9803
  /**
9768
9804
  * @internal
9769
- * @param stream
9805
+ * @param stream the stream to set.
9770
9806
  */
9771
9807
  setMediaStream(stream) {
9772
9808
  this.setCurrentValue(this.mediaStreamSubject, stream);
@@ -9776,7 +9812,7 @@ class InputMediaDeviceManagerState {
9776
9812
  }
9777
9813
  /**
9778
9814
  * @internal
9779
- * @param stream
9815
+ * @param deviceId the device id to set.
9780
9816
  */
9781
9817
  setDevice(deviceId) {
9782
9818
  this.setCurrentValue(this.selectedDeviceSubject, deviceId);
@@ -9893,7 +9929,7 @@ class InputMediaDeviceManager {
9893
9929
  return __awaiter(this, void 0, void 0, function* () {
9894
9930
  if (this.state.prevStatus === 'enabled' &&
9895
9931
  this.state.status === 'disabled') {
9896
- this.enable();
9932
+ yield this.enable();
9897
9933
  }
9898
9934
  });
9899
9935
  }
@@ -10288,7 +10324,7 @@ class CameraManager extends InputMediaDeviceManager {
10288
10324
  flip() {
10289
10325
  return __awaiter(this, void 0, void 0, function* () {
10290
10326
  const newDirection = this.state.direction === 'front' ? 'back' : 'front';
10291
- this.selectDirection(newDirection);
10327
+ yield this.selectDirection(newDirection);
10292
10328
  });
10293
10329
  }
10294
10330
  /**
@@ -10851,7 +10887,6 @@ class Call {
10851
10887
  connectionConfig,
10852
10888
  isDtxEnabled,
10853
10889
  isRedEnabled,
10854
- preferredVideoCodec: this.streamClient.options.preferredVideoCodec,
10855
10890
  });
10856
10891
  }
10857
10892
  if (!isMigrating) {
@@ -11635,27 +11670,6 @@ class Call {
11635
11670
  this.leaveCallHooks.add(createSubscription(this.trackSubscriptionsSubject.pipe(debounce((v) => timer(v.type)), map$2((v) => v.data)), (subscriptions) => { var _a; return (_a = this.sfuClient) === null || _a === void 0 ? void 0 : _a.updateSubscriptions(subscriptions); }));
11636
11671
  this.camera = new CameraManager(this);
11637
11672
  this.microphone = new MicrophoneManager(this);
11638
- this.state.localParticipant$.subscribe((p) => __awaiter(this, void 0, void 0, function* () {
11639
- var _l, _m;
11640
- // Mute via device manager
11641
- // If integrator doesn't use device manager, we mute using stopPublish
11642
- if (!(p === null || p === void 0 ? void 0 : p.publishedTracks.includes(TrackType.VIDEO)) &&
11643
- ((_l = this.publisher) === null || _l === void 0 ? void 0 : _l.isPublishing(TrackType.VIDEO))) {
11644
- this.logger('info', `Local participant's video track is muted remotely`);
11645
- yield this.camera.disable();
11646
- if (this.publisher.isPublishing(TrackType.VIDEO)) {
11647
- this.stopPublish(TrackType.VIDEO);
11648
- }
11649
- }
11650
- if (!(p === null || p === void 0 ? void 0 : p.publishedTracks.includes(TrackType.AUDIO)) &&
11651
- ((_m = this.publisher) === null || _m === void 0 ? void 0 : _m.isPublishing(TrackType.AUDIO))) {
11652
- this.logger('info', `Local participant's audio track is muted remotely`);
11653
- yield this.microphone.disable();
11654
- if (this.publisher.isPublishing(TrackType.AUDIO)) {
11655
- this.stopPublish(TrackType.AUDIO);
11656
- }
11657
- }
11658
- }));
11659
11673
  this.speaker = new SpeakerManager();
11660
11674
  }
11661
11675
  registerEffects() {
@@ -11709,7 +11723,7 @@ class Call {
11709
11723
  this.leaveCallHooks.add(
11710
11724
  // handles the case when the user is blocked by the call owner.
11711
11725
  createSubscription(this.state.blockedUserIds$, (blockedUserIds) => __awaiter(this, void 0, void 0, function* () {
11712
- if (!blockedUserIds)
11726
+ if (!blockedUserIds || blockedUserIds.length === 0)
11713
11727
  return;
11714
11728
  const currentUserId = this.currentUserId;
11715
11729
  if (currentUserId && blockedUserIds.includes(currentUserId)) {
@@ -11845,9 +11859,9 @@ class Call {
11845
11859
  if (this.microphone.state.status === 'enabled' &&
11846
11860
  this.microphone.state.mediaStream &&
11847
11861
  !((_b = this.publisher) === null || _b === void 0 ? void 0 : _b.isPublishing(TrackType.AUDIO))) {
11848
- this.publishAudioStream(this.microphone.state.mediaStream);
11862
+ yield this.publishAudioStream(this.microphone.state.mediaStream);
11849
11863
  }
11850
- // Start mic if backend config speicifies, and there is no local setting
11864
+ // Start mic if backend config specifies, and there is no local setting
11851
11865
  if (this.microphone.state.status === undefined &&
11852
11866
  ((_c = this.state.settings) === null || _c === void 0 ? void 0 : _c.audio.mic_default_on)) {
11853
11867
  yield this.microphone.enable();
@@ -12964,7 +12978,7 @@ class WSConnectionFallback {
12964
12978
  }
12965
12979
  }
12966
12980
 
12967
- const version = '0.3.14';
12981
+ const version = '0.3.16';
12968
12982
 
12969
12983
  const logger = getLogger(['location']);
12970
12984
  const HINT_URL = `https://hint.stream-io-video.com/`;