@stream-io/video-client 0.3.20 → 0.3.21

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.3.21](https://github.com/GetStream/stream-video-js/compare/client0.3.20...client0.3.21) (2023-09-20)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * unmount video element when there is no video track or participant is invisible ([#1096](https://github.com/GetStream/stream-video-js/issues/1096)) ([bd01835](https://github.com/GetStream/stream-video-js/commit/bd01835f4e93c981ca2e5a7e4e09142ea4e326cf)), closes [#1094](https://github.com/GetStream/stream-video-js/issues/1094)
11
+
5
12
  ### [0.3.20](https://github.com/GetStream/stream-video-js/compare/client0.3.19...client0.3.20) (2023-09-19)
6
13
 
7
14
 
@@ -9454,9 +9454,23 @@ class DynascaleManager {
9454
9454
  if (!boundParticipant)
9455
9455
  return;
9456
9456
  const requestTrackWithDimensions = (debounceType, dimension) => {
9457
+ if (dimension && (dimension.width === 0 || dimension.height === 0)) {
9458
+ // ignore 0x0 dimensions. this can happen when the video element
9459
+ // is not visible (e.g., has display: none).
9460
+ // we treat this as "unsubscription" as we don't want to keep
9461
+ // consuming bandwidth for a video that is not visible on the screen.
9462
+ this.logger('debug', `Ignoring 0x0 dimension`, boundParticipant);
9463
+ dimension = undefined;
9464
+ }
9457
9465
  this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
9458
9466
  };
9459
9467
  const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((participant) => participant.sessionId === sessionId)), takeWhile((participant) => !!participant), distinctUntilChanged$1(), shareReplay(1));
9468
+ /**
9469
+ * Since the video elements are now being removed from the DOM (React SDK) upon
9470
+ * visibility change, this subscription is not in use an stays here only for the
9471
+ * plain JS integrations where integrators might choose not to remove the video
9472
+ * elements from the DOM.
9473
+ */
9460
9474
  // keep copy for resize observer handler
9461
9475
  let viewportVisibilityState;
9462
9476
  const viewportVisibilityStateSubscription = boundParticipant.isLocalParticipant
@@ -9501,6 +9515,8 @@ class DynascaleManager {
9501
9515
  lastDimensions = currentDimensions;
9502
9516
  });
9503
9517
  resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe(videoElement);
9518
+ // element renders and gets bound - track subscription gets
9519
+ // triggered first other ones get skipped on initial subscriptions
9504
9520
  const publishedTracksSubscription = boundParticipant.isLocalParticipant
9505
9521
  ? null
9506
9522
  : participant$
@@ -9510,14 +9526,14 @@ class DynascaleManager {
9510
9526
  .subscribe((isPublishing) => {
9511
9527
  if (isPublishing) {
9512
9528
  // the participant just started to publish a track
9513
- requestTrackWithDimensions(DebounceType.IMMEDIATE, {
9529
+ requestTrackWithDimensions(DebounceType.FAST, {
9514
9530
  width: videoElement.clientWidth,
9515
9531
  height: videoElement.clientHeight,
9516
9532
  });
9517
9533
  }
9518
9534
  else {
9519
9535
  // the participant just stopped publishing a track
9520
- requestTrackWithDimensions(DebounceType.IMMEDIATE, undefined);
9536
+ requestTrackWithDimensions(DebounceType.FAST, undefined);
9521
9537
  }
9522
9538
  });
9523
9539
  const streamSubscription = participant$
@@ -9542,7 +9558,7 @@ class DynascaleManager {
9542
9558
  // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9543
9559
  videoElement.muted = true;
9544
9560
  return () => {
9545
- requestTrackWithDimensions(DebounceType.IMMEDIATE, undefined);
9561
+ requestTrackWithDimensions(DebounceType.FAST, undefined);
9546
9562
  viewportVisibilityStateSubscription === null || viewportVisibilityStateSubscription === void 0 ? void 0 : viewportVisibilityStateSubscription.unsubscribe();
9547
9563
  publishedTracksSubscription === null || publishedTracksSubscription === void 0 ? void 0 : publishedTracksSubscription.unsubscribe();
9548
9564
  streamSubscription.unsubscribe();
@@ -13108,7 +13124,7 @@ class WSConnectionFallback {
13108
13124
  }
13109
13125
  }
13110
13126
 
13111
- const version = '0.3.20';
13127
+ const version = '0.3.21';
13112
13128
 
13113
13129
  const logger = getLogger(['location']);
13114
13130
  const HINT_URL = `https://hint.stream-io-video.com/`;