@stream-io/video-client 0.0.8 → 0.0.9

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.0.9](https://github.com/GetStream/stream-video-js/compare/client0.0.8...client0.0.9) (2023-06-12)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * prevent misleading "stop publish" log messages upon call instantiation ([#629](https://github.com/GetStream/stream-video-js/issues/629)) ([af40939](https://github.com/GetStream/stream-video-js/commit/af4093966c408d37fbf59c4c8fafd22756aa8888))
11
+
5
12
  ### [0.0.8](https://github.com/GetStream/stream-video-js/compare/client0.0.7...client0.0.8) (2023-06-09)
6
13
 
7
14
 
@@ -5692,6 +5692,19 @@ class Publisher {
5692
5692
  return this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
5693
5693
  }
5694
5694
  });
5695
+ /**
5696
+ * Returns true if the given track type is currently being published to the SFU.
5697
+ *
5698
+ * @param trackType the track type to check.
5699
+ */
5700
+ this.isPublishing = (trackType) => {
5701
+ const transceiverForTrackType = this.transceiverRegistry[trackType];
5702
+ if (transceiverForTrackType && transceiverForTrackType.sender) {
5703
+ const sender = transceiverForTrackType.sender;
5704
+ return !!sender.track && sender.track.readyState === 'live';
5705
+ }
5706
+ return false;
5707
+ };
5695
5708
  this.notifyTrackMuteStateChanged = (mediaStream, track, trackType, isMuted) => __awaiter(this, void 0, void 0, function* () {
5696
5709
  yield this.sfuClient.updateMuteState(trackType, isMuted);
5697
5710
  const audioOrVideoOrScreenShareStream = trackTypeToParticipantStreamKey(trackType);
@@ -9291,20 +9304,22 @@ class Call {
9291
9304
  createSubscription(this.state.ownCapabilities$, (ownCapabilities) => {
9292
9305
  // update the permission context.
9293
9306
  this.permissionsContext.setPermissions(ownCapabilities);
9307
+ if (!this.publisher)
9308
+ return;
9294
9309
  // check if the user still has publishing permissions and stop publishing if not.
9295
9310
  const permissionToTrackType = {
9296
9311
  [OwnCapability.SEND_AUDIO]: TrackType.AUDIO,
9297
9312
  [OwnCapability.SEND_VIDEO]: TrackType.VIDEO,
9298
9313
  [OwnCapability.SCREENSHARE]: TrackType.SCREEN_SHARE,
9299
9314
  };
9300
- Object.entries(permissionToTrackType).forEach(([permission, type]) => {
9315
+ for (const [permission, trackType] of Object.entries(permissionToTrackType)) {
9301
9316
  const hasPermission = this.permissionsContext.hasPermission(permission);
9302
- if (!hasPermission) {
9303
- this.stopPublish(type).catch((err) => {
9304
- console.error('Error stopping publish', type, err);
9317
+ if (!hasPermission && this.publisher.isPublishing(trackType)) {
9318
+ this.stopPublish(trackType).catch((err) => {
9319
+ console.error('Error stopping publish', trackType, err);
9305
9320
  });
9306
9321
  }
9307
- });
9322
+ }
9308
9323
  }),
9309
9324
  // handles the case when the user is blocked by the call owner.
9310
9325
  createSubscription(this.state.metadata$, (metadata) => __awaiter(this, void 0, void 0, function* () {
@@ -11005,7 +11020,7 @@ class StreamClient {
11005
11020
  }
11006
11021
  getUserAgent() {
11007
11022
  return (this.userAgent ||
11008
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.7"}`);
11023
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.8"}`);
11009
11024
  }
11010
11025
  setUserAgent(userAgent) {
11011
11026
  this.userAgent = userAgent;