@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.es.js CHANGED
@@ -8354,6 +8354,8 @@ class CallState {
8354
8354
  'connection.error': undefined,
8355
8355
  'connection.ok': undefined,
8356
8356
  'health.check': undefined,
8357
+ 'call.recording_failed': undefined,
8358
+ 'call.recording_ready': undefined,
8357
8359
  custom: undefined,
8358
8360
  // events that update call state:
8359
8361
  'call.accepted': (e) => this.updateFromCallResponse(e.call),
@@ -9455,9 +9457,23 @@ class DynascaleManager {
9455
9457
  if (!boundParticipant)
9456
9458
  return;
9457
9459
  const requestTrackWithDimensions = (debounceType, dimension) => {
9460
+ if (dimension && (dimension.width === 0 || dimension.height === 0)) {
9461
+ // ignore 0x0 dimensions. this can happen when the video element
9462
+ // is not visible (e.g., has display: none).
9463
+ // we treat this as "unsubscription" as we don't want to keep
9464
+ // consuming bandwidth for a video that is not visible on the screen.
9465
+ this.logger('debug', `Ignoring 0x0 dimension`, boundParticipant);
9466
+ dimension = undefined;
9467
+ }
9458
9468
  this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
9459
9469
  };
9460
9470
  const participant$ = this.call.state.participants$.pipe(map$2((participants) => participants.find((participant) => participant.sessionId === sessionId)), takeWhile((participant) => !!participant), distinctUntilChanged$1(), shareReplay(1));
9471
+ /**
9472
+ * Since the video elements are now being removed from the DOM (React SDK) upon
9473
+ * visibility change, this subscription is not in use an stays here only for the
9474
+ * plain JS integrations where integrators might choose not to remove the video
9475
+ * elements from the DOM.
9476
+ */
9461
9477
  // keep copy for resize observer handler
9462
9478
  let viewportVisibilityState;
9463
9479
  const viewportVisibilityStateSubscription = boundParticipant.isLocalParticipant
@@ -9502,6 +9518,8 @@ class DynascaleManager {
9502
9518
  lastDimensions = currentDimensions;
9503
9519
  });
9504
9520
  resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.observe(videoElement);
9521
+ // element renders and gets bound - track subscription gets
9522
+ // triggered first other ones get skipped on initial subscriptions
9505
9523
  const publishedTracksSubscription = boundParticipant.isLocalParticipant
9506
9524
  ? null
9507
9525
  : participant$
@@ -9511,14 +9529,14 @@ class DynascaleManager {
9511
9529
  .subscribe((isPublishing) => {
9512
9530
  if (isPublishing) {
9513
9531
  // the participant just started to publish a track
9514
- requestTrackWithDimensions(DebounceType.IMMEDIATE, {
9532
+ requestTrackWithDimensions(DebounceType.FAST, {
9515
9533
  width: videoElement.clientWidth,
9516
9534
  height: videoElement.clientHeight,
9517
9535
  });
9518
9536
  }
9519
9537
  else {
9520
9538
  // the participant just stopped publishing a track
9521
- requestTrackWithDimensions(DebounceType.IMMEDIATE, undefined);
9539
+ requestTrackWithDimensions(DebounceType.FAST, undefined);
9522
9540
  }
9523
9541
  });
9524
9542
  const streamSubscription = participant$
@@ -9543,7 +9561,7 @@ class DynascaleManager {
9543
9561
  // https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
9544
9562
  videoElement.muted = true;
9545
9563
  return () => {
9546
- requestTrackWithDimensions(DebounceType.IMMEDIATE, undefined);
9564
+ requestTrackWithDimensions(DebounceType.FAST, undefined);
9547
9565
  viewportVisibilityStateSubscription === null || viewportVisibilityStateSubscription === void 0 ? void 0 : viewportVisibilityStateSubscription.unsubscribe();
9548
9566
  publishedTracksSubscription === null || publishedTracksSubscription === void 0 ? void 0 : publishedTracksSubscription.unsubscribe();
9549
9567
  streamSubscription.unsubscribe();
@@ -13110,7 +13128,7 @@ class WSConnectionFallback {
13110
13128
  }
13111
13129
  }
13112
13130
 
13113
- const version = '0.3.19';
13131
+ const version = '0.3.21';
13114
13132
 
13115
13133
  const logger = getLogger(['location']);
13116
13134
  const HINT_URL = `https://hint.stream-io-video.com/`;