livekit-client 2.6.3 → 2.7.0
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/livekit-client.esm.mjs +27 -12
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/ts4.2/src/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/room/track/RemoteVideoTrack.ts +27 -12
- package/src/type-polyfills/document-pip.d.ts +12 -0
@@ -11177,7 +11177,7 @@ function getOSVersion(ua) {
|
|
11177
11177
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
11178
11178
|
}
|
11179
11179
|
|
11180
|
-
var version$1 = "2.
|
11180
|
+
var version$1 = "2.7.0";
|
11181
11181
|
|
11182
11182
|
const version = version$1;
|
11183
11183
|
const protocolVersion = 15;
|
@@ -18578,23 +18578,25 @@ class HTMLElementInfo {
|
|
18578
18578
|
} = entry;
|
18579
18579
|
if (target === this.element) {
|
18580
18580
|
this.isIntersecting = isIntersecting;
|
18581
|
+
this.isPiP = isElementInPiP(this.element);
|
18581
18582
|
this.visibilityChangedAt = Date.now();
|
18582
18583
|
(_a = this.handleVisibilityChanged) === null || _a === void 0 ? void 0 : _a.call(this);
|
18583
18584
|
}
|
18584
18585
|
};
|
18585
18586
|
this.onEnterPiP = () => {
|
18586
|
-
var _a;
|
18587
|
-
|
18588
|
-
|
18587
|
+
var _a, _b, _c;
|
18588
|
+
(_b = (_a = window.documentPictureInPicture) === null || _a === void 0 ? void 0 : _a.window) === null || _b === void 0 ? void 0 : _b.addEventListener('pagehide', this.onLeavePiP);
|
18589
|
+
this.isPiP = isElementInPiP(this.element);
|
18590
|
+
(_c = this.handleVisibilityChanged) === null || _c === void 0 ? void 0 : _c.call(this);
|
18589
18591
|
};
|
18590
18592
|
this.onLeavePiP = () => {
|
18591
18593
|
var _a;
|
18592
|
-
this.isPiP =
|
18594
|
+
this.isPiP = isElementInPiP(this.element);
|
18593
18595
|
(_a = this.handleVisibilityChanged) === null || _a === void 0 ? void 0 : _a.call(this);
|
18594
18596
|
};
|
18595
18597
|
this.element = element;
|
18596
18598
|
this.isIntersecting = visible !== null && visible !== void 0 ? visible : isElementInViewport(element);
|
18597
|
-
this.isPiP = isWeb() &&
|
18599
|
+
this.isPiP = isWeb() && isElementInPiP(element);
|
18598
18600
|
this.visibilityChangedAt = 0;
|
18599
18601
|
}
|
18600
18602
|
width() {
|
@@ -18604,9 +18606,10 @@ class HTMLElementInfo {
|
|
18604
18606
|
return this.element.clientHeight;
|
18605
18607
|
}
|
18606
18608
|
observe() {
|
18609
|
+
var _a, _b, _c;
|
18607
18610
|
// make sure we update the current visible state once we start to observe
|
18608
18611
|
this.isIntersecting = isElementInViewport(this.element);
|
18609
|
-
this.isPiP =
|
18612
|
+
this.isPiP = isElementInPiP(this.element);
|
18610
18613
|
this.element.handleResize = () => {
|
18611
18614
|
var _a;
|
18612
18615
|
(_a = this.handleResize) === null || _a === void 0 ? void 0 : _a.call(this);
|
@@ -18616,17 +18619,30 @@ class HTMLElementInfo {
|
|
18616
18619
|
getResizeObserver().observe(this.element);
|
18617
18620
|
this.element.addEventListener('enterpictureinpicture', this.onEnterPiP);
|
18618
18621
|
this.element.addEventListener('leavepictureinpicture', this.onLeavePiP);
|
18622
|
+
(_a = window.documentPictureInPicture) === null || _a === void 0 ? void 0 : _a.addEventListener('enter', this.onEnterPiP);
|
18623
|
+
(_c = (_b = window.documentPictureInPicture) === null || _b === void 0 ? void 0 : _b.window) === null || _c === void 0 ? void 0 : _c.addEventListener('pagehide', this.onLeavePiP);
|
18619
18624
|
}
|
18620
18625
|
stopObserving() {
|
18621
|
-
var _a, _b;
|
18626
|
+
var _a, _b, _c, _d, _e;
|
18622
18627
|
(_a = getIntersectionObserver()) === null || _a === void 0 ? void 0 : _a.unobserve(this.element);
|
18623
18628
|
(_b = getResizeObserver()) === null || _b === void 0 ? void 0 : _b.unobserve(this.element);
|
18624
18629
|
this.element.removeEventListener('enterpictureinpicture', this.onEnterPiP);
|
18625
18630
|
this.element.removeEventListener('leavepictureinpicture', this.onLeavePiP);
|
18631
|
+
(_c = window.documentPictureInPicture) === null || _c === void 0 ? void 0 : _c.removeEventListener('enter', this.onEnterPiP);
|
18632
|
+
(_e = (_d = window.documentPictureInPicture) === null || _d === void 0 ? void 0 : _d.window) === null || _e === void 0 ? void 0 : _e.removeEventListener('pagehide', this.onLeavePiP);
|
18626
18633
|
}
|
18627
18634
|
}
|
18628
|
-
|
18629
|
-
|
18635
|
+
function isElementInPiP(el) {
|
18636
|
+
var _a, _b;
|
18637
|
+
// Simple video PiP
|
18638
|
+
if (document.pictureInPictureElement === el) return true;
|
18639
|
+
// Document PiP
|
18640
|
+
if ((_a = window.documentPictureInPicture) === null || _a === void 0 ? void 0 : _a.window) return isElementInViewport(el, (_b = window.documentPictureInPicture) === null || _b === void 0 ? void 0 : _b.window);
|
18641
|
+
return false;
|
18642
|
+
}
|
18643
|
+
// does not account for occlusion by other elements or opacity property
|
18644
|
+
function isElementInViewport(el, win) {
|
18645
|
+
const viewportWindow = win || window;
|
18630
18646
|
let top = el.offsetTop;
|
18631
18647
|
let left = el.offsetLeft;
|
18632
18648
|
const width = el.offsetWidth;
|
@@ -18635,7 +18651,6 @@ function isElementInViewport(el) {
|
|
18635
18651
|
hidden
|
18636
18652
|
} = el;
|
18637
18653
|
const {
|
18638
|
-
opacity,
|
18639
18654
|
display
|
18640
18655
|
} = getComputedStyle(el);
|
18641
18656
|
while (el.offsetParent) {
|
@@ -18643,7 +18658,7 @@ function isElementInViewport(el) {
|
|
18643
18658
|
top += el.offsetTop;
|
18644
18659
|
left += el.offsetLeft;
|
18645
18660
|
}
|
18646
|
-
return top <
|
18661
|
+
return top < viewportWindow.pageYOffset + viewportWindow.innerHeight && left < viewportWindow.pageXOffset + viewportWindow.innerWidth && top + height > viewportWindow.pageYOffset && left + width > viewportWindow.pageXOffset && !hidden && display !== 'none';
|
18647
18662
|
}
|
18648
18663
|
|
18649
18664
|
class TrackPublication extends eventsExports.EventEmitter {
|