@stream-io/video-client 0.3.19 → 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/dist/index.cjs.js CHANGED
@@ -8374,6 +8374,8 @@ class CallState {
8374
8374
  'connection.error': undefined,
8375
8375
  'connection.ok': undefined,
8376
8376
  'health.check': undefined,
8377
+ 'call.recording_failed': undefined,
8378
+ 'call.recording_ready': undefined,
8377
8379
  custom: undefined,
8378
8380
  // events that update call state:
8379
8381
  'call.accepted': (e) => this.updateFromCallResponse(e.call),
@@ -9475,9 +9477,23 @@ class DynascaleManager {
9475
9477
  if (!boundParticipant)
9476
9478
  return;
9477
9479
  const requestTrackWithDimensions = (debounceType, dimension) => {
9480
+ if (dimension && (dimension.width === 0 || dimension.height === 0)) {
9481
+ // ignore 0x0 dimensions. this can happen when the video element
9482
+ // is not visible (e.g., has display: none).
9483
+ // we treat this as "unsubscription" as we don't want to keep
9484
+ // consuming bandwidth for a video that is not visible on the screen.
9485
+ this.logger('debug', `Ignoring 0x0 dimension`, boundParticipant);
9486
+ dimension = undefined;
9487
+ }
9478
9488
  this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
9479
9489
  };
9480
9490
  const participant$ = this.call.state.participants$.pipe(rxjs.map((participants) => participants.find((participant) => participant.sessionId === sessionId)), rxjs.takeWhile((participant) => !!participant), rxjs.distinctUntilChanged(), rxjs.shareReplay(1));
9491
+ /**
9492
+ * Since the video elements are now being removed from the DOM (React SDK) upon
9493
+ * visibility change, this subscription is not in use an stays here only for the
9494
+ * plain JS integrations where integrators might choose not to remove the video
9495
+ * elements from the DOM.
9496
+ */
9481
9497
  // keep copy for resize observer handler
9482
9498
  let viewportVisibilityState;
9483
9499
  const viewportVisibilityStateSubscription = boundParticipant.isLocalParticipant
@@ -9522,6 +9538,8 @@ class DynascaleManager {
9522
9538
  lastDimensions = currentDimensions;
9523
9539
  });
9524
9540
  resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe(videoElement);
9541
+ // element renders and gets bound - track subscription gets
9542
+ // triggered first other ones get skipped on initial subscriptions
9525
9543
  const publishedTracksSubscription = boundParticipant.isLocalParticipant
9526
9544
  ? null
9527
9545
  : participant$
@@ -9531,14 +9549,14 @@ class DynascaleManager {
9531
9549
  .subscribe((isPublishing) => {
9532
9550
  if (isPublishing) {
9533
9551
  // the participant just started to publish a track
9534
- requestTrackWithDimensions(exports.DebounceType.IMMEDIATE, {
9552
+ requestTrackWithDimensions(exports.DebounceType.FAST, {
9535
9553
  width: videoElement.clientWidth,
9536
9554
  height: videoElement.clientHeight,
9537
9555
  });
9538
9556
  }
9539
9557
  else {
9540
9558
  // the participant just stopped publishing a track
9541
- requestTrackWithDimensions(exports.DebounceType.IMMEDIATE, undefined);
9559
+ requestTrackWithDimensions(exports.DebounceType.FAST, undefined);
9542
9560
  }
9543
9561
  });
9544
9562
  const streamSubscription = participant$
@@ -9563,7 +9581,7 @@ class DynascaleManager {
9563
9581
  // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9564
9582
  videoElement.muted = true;
9565
9583
  return () => {
9566
- requestTrackWithDimensions(exports.DebounceType.IMMEDIATE, undefined);
9584
+ requestTrackWithDimensions(exports.DebounceType.FAST, undefined);
9567
9585
  viewportVisibilityStateSubscription === null || viewportVisibilityStateSubscription === void 0 ? void 0 : viewportVisibilityStateSubscription.unsubscribe();
9568
9586
  publishedTracksSubscription === null || publishedTracksSubscription === void 0 ? void 0 : publishedTracksSubscription.unsubscribe();
9569
9587
  streamSubscription.unsubscribe();
@@ -13130,7 +13148,7 @@ class WSConnectionFallback {
13130
13148
  }
13131
13149
  }
13132
13150
 
13133
- const version = '0.3.19';
13151
+ const version = '0.3.21';
13134
13152
 
13135
13153
  const logger = getLogger(['location']);
13136
13154
  const HINT_URL = `https://hint.stream-io-video.com/`;