@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 +7 -0
- package/dist/index.browser.es.js +20 -4
- package/dist/index.browser.es.js.map +1 -1
- package/dist/index.cjs.js +20 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +20 -4
- package/dist/index.es.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/__tests__/server-side/call.test.ts +1 -1
- package/src/helpers/DynascaleManager.ts +19 -3
- package/src/helpers/__tests__/DynascaleManager.test.ts +51 -11
package/dist/index.es.js
CHANGED
|
@@ -9457,9 +9457,23 @@ class DynascaleManager {
|
|
|
9457
9457
|
if (!boundParticipant)
|
|
9458
9458
|
return;
|
|
9459
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
|
+
}
|
|
9460
9468
|
this.call.updateSubscriptionsPartial(trackType, { [sessionId]: { dimension } }, debounceType);
|
|
9461
9469
|
};
|
|
9462
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
|
+
*/
|
|
9463
9477
|
// keep copy for resize observer handler
|
|
9464
9478
|
let viewportVisibilityState;
|
|
9465
9479
|
const viewportVisibilityStateSubscription = boundParticipant.isLocalParticipant
|
|
@@ -9504,6 +9518,8 @@ class DynascaleManager {
|
|
|
9504
9518
|
lastDimensions = currentDimensions;
|
|
9505
9519
|
});
|
|
9506
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
|
|
9507
9523
|
const publishedTracksSubscription = boundParticipant.isLocalParticipant
|
|
9508
9524
|
? null
|
|
9509
9525
|
: participant$
|
|
@@ -9513,14 +9529,14 @@ class DynascaleManager {
|
|
|
9513
9529
|
.subscribe((isPublishing) => {
|
|
9514
9530
|
if (isPublishing) {
|
|
9515
9531
|
// the participant just started to publish a track
|
|
9516
|
-
requestTrackWithDimensions(DebounceType.
|
|
9532
|
+
requestTrackWithDimensions(DebounceType.FAST, {
|
|
9517
9533
|
width: videoElement.clientWidth,
|
|
9518
9534
|
height: videoElement.clientHeight,
|
|
9519
9535
|
});
|
|
9520
9536
|
}
|
|
9521
9537
|
else {
|
|
9522
9538
|
// the participant just stopped publishing a track
|
|
9523
|
-
requestTrackWithDimensions(DebounceType.
|
|
9539
|
+
requestTrackWithDimensions(DebounceType.FAST, undefined);
|
|
9524
9540
|
}
|
|
9525
9541
|
});
|
|
9526
9542
|
const streamSubscription = participant$
|
|
@@ -9545,7 +9561,7 @@ class DynascaleManager {
|
|
|
9545
9561
|
// https://developer.mozilla.org/en-US/docs/Web/Media/Autoplay_guide
|
|
9546
9562
|
videoElement.muted = true;
|
|
9547
9563
|
return () => {
|
|
9548
|
-
requestTrackWithDimensions(DebounceType.
|
|
9564
|
+
requestTrackWithDimensions(DebounceType.FAST, undefined);
|
|
9549
9565
|
viewportVisibilityStateSubscription === null || viewportVisibilityStateSubscription === void 0 ? void 0 : viewportVisibilityStateSubscription.unsubscribe();
|
|
9550
9566
|
publishedTracksSubscription === null || publishedTracksSubscription === void 0 ? void 0 : publishedTracksSubscription.unsubscribe();
|
|
9551
9567
|
streamSubscription.unsubscribe();
|
|
@@ -13112,7 +13128,7 @@ class WSConnectionFallback {
|
|
|
13112
13128
|
}
|
|
13113
13129
|
}
|
|
13114
13130
|
|
|
13115
|
-
const version = '0.3.
|
|
13131
|
+
const version = '0.3.21';
|
|
13116
13132
|
|
|
13117
13133
|
const logger = getLogger(['location']);
|
|
13118
13134
|
const HINT_URL = `https://hint.stream-io-video.com/`;
|