@stream-io/video-client 0.0.1-alpha.126 → 0.0.1-alpha.128

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,25 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.1-alpha.128](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.127...client0.0.1-alpha.128) (2023-05-09)
6
+
7
+
8
+ ### Reverts
9
+
10
+ * Revert "chore: Avoid non-atomic pushes resulting in invalid version tags" ([24be283](https://github.com/GetStream/stream-video-js/commit/24be28300a5f5d452338457d60b1e34682027be6))
11
+
12
+
13
+
14
+ ## [0.0.1-alpha.127](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.126...client0.0.1-alpha.127) (2023-05-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **permissions:** add shortcut APIs ([#475](https://github.com/GetStream/stream-video-js/issues/475)) ([466614c](https://github.com/GetStream/stream-video-js/commit/466614ccf7f15cb16fffc97d5aa05318d2adf7e7))
20
+ * preserve last used deviceId when muting ([#470](https://github.com/GetStream/stream-video-js/issues/470)) ([b4ed2d0](https://github.com/GetStream/stream-video-js/commit/b4ed2d0cce1456a748f070bc01a68df574683862))
21
+
22
+
23
+
5
24
  ## [0.0.1-alpha.126](https://github.com/GetStream/stream-video-js/compare/client0.0.1-alpha.125...client0.0.1-alpha.126) (2023-05-08)
6
25
 
7
26
 
@@ -5240,6 +5240,18 @@ const trackTypeToParticipantStreamKey = (trackType) => {
5240
5240
  throw new Error(`Unknown track type: ${trackType}`);
5241
5241
  }
5242
5242
  };
5243
+ const trackTypeToDeviceIdKey = (trackType) => {
5244
+ switch (trackType) {
5245
+ case TrackType.AUDIO:
5246
+ return 'audioDeviceId';
5247
+ case TrackType.VIDEO:
5248
+ return 'videoDeviceId';
5249
+ case TrackType.SCREEN_SHARE:
5250
+ return undefined;
5251
+ default:
5252
+ throw new Error(`Unknown track type: ${trackType}`);
5253
+ }
5254
+ };
5243
5255
  const muteTypeToTrackType = (muteType) => {
5244
5256
  switch (muteType) {
5245
5257
  case 'audio':
@@ -5298,7 +5310,7 @@ class Publisher {
5298
5310
  */
5299
5311
  const handleTrackEnded = () => __awaiter(this, void 0, void 0, function* () {
5300
5312
  console.log(`Track ${TrackType[trackType]} has ended, notifying the SFU`);
5301
- yield this.notifyTrackMuteStateChanged(mediaStream, trackType, true);
5313
+ yield this.notifyTrackMuteStateChanged(mediaStream, track, trackType, true);
5302
5314
  // clean-up, this event listener needs to run only once.
5303
5315
  track.removeEventListener('ended', handleTrackEnded);
5304
5316
  });
@@ -5334,14 +5346,14 @@ class Publisher {
5334
5346
  }
5335
5347
  yield transceiver.sender.replaceTrack(track);
5336
5348
  }
5337
- yield this.notifyTrackMuteStateChanged(mediaStream, trackType, false);
5349
+ yield this.notifyTrackMuteStateChanged(mediaStream, track, trackType, false);
5338
5350
  });
5339
5351
  /**
5340
5352
  * Stops publishing the given track type to the SFU, if it is currently being published.
5341
5353
  * Underlying track will be stopped and removed from the publisher.
5342
5354
  * @param trackType the track type to unpublish.
5343
5355
  */
5344
- this.unpublishStream = (trackType) => {
5356
+ this.unpublishStream = (trackType) => __awaiter(this, void 0, void 0, function* () {
5345
5357
  const transceiver = this.publisher
5346
5358
  .getTransceivers()
5347
5359
  .find((t) => t === this.transceiverRegistry[trackType] && t.sender.track);
@@ -5349,10 +5361,10 @@ class Publisher {
5349
5361
  transceiver.sender.track &&
5350
5362
  transceiver.sender.track.readyState === 'live') {
5351
5363
  transceiver.sender.track.stop();
5352
- return this.notifyTrackMuteStateChanged(undefined, trackType, true);
5364
+ return this.notifyTrackMuteStateChanged(undefined, transceiver.sender.track, trackType, true);
5353
5365
  }
5354
- };
5355
- this.notifyTrackMuteStateChanged = (mediaStream, trackType, isMuted) => __awaiter(this, void 0, void 0, function* () {
5366
+ });
5367
+ this.notifyTrackMuteStateChanged = (mediaStream, track, trackType, isMuted) => __awaiter(this, void 0, void 0, function* () {
5356
5368
  yield this.sfuClient.updateMuteState(trackType, isMuted);
5357
5369
  const audioOrVideoOrScreenShareStream = trackTypeToParticipantStreamKey(trackType);
5358
5370
  if (isMuted) {
@@ -5362,12 +5374,13 @@ class Publisher {
5362
5374
  }));
5363
5375
  }
5364
5376
  else {
5365
- this.state.updateParticipant(this.sfuClient.sessionId, (p) => ({
5366
- publishedTracks: p.publishedTracks.includes(trackType)
5367
- ? p.publishedTracks
5368
- : [...p.publishedTracks, trackType],
5369
- [audioOrVideoOrScreenShareStream]: mediaStream,
5370
- }));
5377
+ const deviceId = track.getSettings().deviceId;
5378
+ const audioOrVideoDeviceKey = trackTypeToDeviceIdKey(trackType);
5379
+ this.state.updateParticipant(this.sfuClient.sessionId, (p) => {
5380
+ return Object.assign(Object.assign({ publishedTracks: p.publishedTracks.includes(trackType)
5381
+ ? p.publishedTracks
5382
+ : [...p.publishedTracks, trackType] }, (audioOrVideoDeviceKey && { [audioOrVideoDeviceKey]: deviceId })), { [audioOrVideoOrScreenShareStream]: mediaStream });
5383
+ });
5371
5384
  }
5372
5385
  });
5373
5386
  /**
@@ -8420,6 +8433,42 @@ class Call {
8420
8433
  }
8421
8434
  return this.streamClient.post(`${this.streamClientBasePath}/request_permission`, data);
8422
8435
  });
8436
+ /**
8437
+ * Allows you to grant certain permissions to a user in a call.
8438
+ * The permissions are specific to the call experience and do not survive the call itself.
8439
+ *
8440
+ * Supported permissions that can be granted are:
8441
+ * - `send-audio`
8442
+ * - `send-video`
8443
+ * - `screenshare`
8444
+ *
8445
+ * @param userId the id of the user to grant permissions to.
8446
+ * @param permissions the permissions to grant.
8447
+ */
8448
+ this.grantPermissions = (userId, permissions) => __awaiter(this, void 0, void 0, function* () {
8449
+ return this.updateUserPermissions({
8450
+ user_id: userId,
8451
+ grant_permissions: permissions,
8452
+ });
8453
+ });
8454
+ /**
8455
+ * Allows you to revoke certain permissions from a user in a call.
8456
+ * The permissions are specific to the call experience and do not survive the call itself.
8457
+ *
8458
+ * Supported permissions that can be revoked are:
8459
+ * - `send-audio`
8460
+ * - `send-video`
8461
+ * - `screenshare`
8462
+ *
8463
+ * @param userId the id of the user to revoke permissions from.
8464
+ * @param permissions the permissions to revoke.
8465
+ */
8466
+ this.revokePermissions = (userId, permissions) => __awaiter(this, void 0, void 0, function* () {
8467
+ return this.updateUserPermissions({
8468
+ user_id: userId,
8469
+ revoke_permissions: permissions,
8470
+ });
8471
+ });
8423
8472
  /**
8424
8473
  * Allows you to grant or revoke a specific permission to a user in a call. The permissions are specific to the call experience and do not survive the call itself.
8425
8474
  *
@@ -10271,7 +10320,7 @@ class StreamClient {
10271
10320
  }
10272
10321
  getUserAgent() {
10273
10322
  return (this.userAgent ||
10274
- `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.125"}`);
10323
+ `stream-video-javascript-client-${this.node ? 'node' : 'browser'}-${"0.0.1-alpha.127"}`);
10275
10324
  }
10276
10325
  setUserAgent(userAgent) {
10277
10326
  this.userAgent = userAgent;