@snapcall/stream-ui 1.7.0 → 1.8.1
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/stream-ui.esm.js +206 -174
- package/dist/stream-ui.js +206 -174
- package/dist/stream-ui.umd.js +114 -130
- package/package.json +2 -2
package/dist/stream-ui.esm.js
CHANGED
|
@@ -1190,7 +1190,7 @@ class $a2f0e3c29b11c88e$export$2e2bcd8739ae039 {
|
|
|
1190
1190
|
|
|
1191
1191
|
|
|
1192
1192
|
const $0148b6fd862a22e8$var$log = new (0, $0f65a9eaf4a1e910$export$2e2bcd8739ae039)("MediaPipe");
|
|
1193
|
-
const $0148b6fd862a22e8$var$mediapipeUrl = "https://stream-assets.snapcall.io
|
|
1193
|
+
const $0148b6fd862a22e8$var$mediapipeUrl = "https://stream-assets.snapcall.io";
|
|
1194
1194
|
let $0148b6fd862a22e8$var$selfieSegmentationInitialized = false;
|
|
1195
1195
|
const $0148b6fd862a22e8$var$selfieSegmentation = new $3Sbms$SelfieSegmentation({
|
|
1196
1196
|
locateFile: (file, prefix)=>{
|
|
@@ -1776,10 +1776,15 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
|
|
|
1776
1776
|
async joinRoom() {
|
|
1777
1777
|
this.streamerMediasoup = await (0, $a2f0e3c29b11c88e$export$2e2bcd8739ae039).create(this.protoo, this.config);
|
|
1778
1778
|
// now we join
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1779
|
+
const { apiKey: apiKey , email: email } = this.joinOptions;
|
|
1780
|
+
if (apiKey) try {
|
|
1781
|
+
let agentInfo = null;
|
|
1782
|
+
if (apiKey && email) agentInfo = await this.fetchAgentInfo({
|
|
1783
|
+
apiKey: apiKey,
|
|
1784
|
+
email: email
|
|
1785
|
+
});
|
|
1786
|
+
else if (apiKey) agentInfo = await this.fetchUserInfo({
|
|
1787
|
+
apiKey: apiKey
|
|
1783
1788
|
});
|
|
1784
1789
|
if (agentInfo) this.dispatchEvent(new $c31e3fb4360572af$var$SnapcallEvent("agentIdentity", {
|
|
1785
1790
|
detail: {
|
|
@@ -1796,8 +1801,8 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
|
|
|
1796
1801
|
}));
|
|
1797
1802
|
}
|
|
1798
1803
|
const { peers: peers } = await this.protoo.request("getRoomPeers", {
|
|
1799
|
-
apiKey:
|
|
1800
|
-
email:
|
|
1804
|
+
apiKey: apiKey,
|
|
1805
|
+
email: email
|
|
1801
1806
|
});
|
|
1802
1807
|
this.peers = new Map(peers.map((peer)=>[
|
|
1803
1808
|
peer.id || peer.peerId,
|
|
@@ -2675,6 +2680,19 @@ class $c31e3fb4360572af$export$2e2bcd8739ae039 extends $c31e3fb4360572af$var$Str
|
|
|
2675
2680
|
});
|
|
2676
2681
|
return agent;
|
|
2677
2682
|
}
|
|
2683
|
+
async fetchUserInfo({ apiKey: apiKey }) {
|
|
2684
|
+
const apiURL = this.config.apiUrl;
|
|
2685
|
+
const user = await fetch(`${apiURL}/users/me`, {
|
|
2686
|
+
method: "get",
|
|
2687
|
+
headers: {
|
|
2688
|
+
Authorization: `Bearer ${apiKey}`
|
|
2689
|
+
}
|
|
2690
|
+
}).then((response)=>{
|
|
2691
|
+
if (response.ok) return response.json();
|
|
2692
|
+
throw new Error("Invalid user info");
|
|
2693
|
+
});
|
|
2694
|
+
return user;
|
|
2695
|
+
}
|
|
2678
2696
|
setConfig(config) {
|
|
2679
2697
|
this.config = {
|
|
2680
2698
|
...this.config,
|
|
@@ -3633,7 +3651,7 @@ const $f235befa4cdc42d6$var$Header = ()=>{
|
|
|
3633
3651
|
]
|
|
3634
3652
|
},
|
|
3635
3653
|
];
|
|
3636
|
-
if ($f235befa4cdc42d6$var$browser.platform.type === "desktop" && $f235befa4cdc42d6$var$browser.engine.name === "Blink") computedCategories[2].items.
|
|
3654
|
+
if ($f235befa4cdc42d6$var$browser.platform.type === "desktop" && $f235befa4cdc42d6$var$browser.engine.name === "Blink") computedCategories[2].items.unshift({
|
|
3637
3655
|
id: "virtualBackground",
|
|
3638
3656
|
title: t("virtualBackground.title"),
|
|
3639
3657
|
jsxIcon: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $2da9626742e3560b$export$d5424e4dfe4be076), {}),
|
|
@@ -3702,6 +3720,35 @@ const $af23c74942bdcae7$export$2b86bedf890eab8 = (element)=>{
|
|
|
3702
3720
|
]);
|
|
3703
3721
|
return size;
|
|
3704
3722
|
};
|
|
3723
|
+
const $af23c74942bdcae7$var$defaultState = {
|
|
3724
|
+
bottom: 0,
|
|
3725
|
+
height: 0,
|
|
3726
|
+
left: 0,
|
|
3727
|
+
right: 0,
|
|
3728
|
+
top: 0,
|
|
3729
|
+
width: 0,
|
|
3730
|
+
x: 0,
|
|
3731
|
+
y: 0
|
|
3732
|
+
};
|
|
3733
|
+
function $af23c74942bdcae7$export$e295b0c537d32d7d() {
|
|
3734
|
+
const [element, ref] = (0, $3Sbms$useState)(null);
|
|
3735
|
+
const [rect, setRect] = (0, $3Sbms$useState)($af23c74942bdcae7$var$defaultState);
|
|
3736
|
+
(0, $3Sbms$useLayoutEffect)(()=>{
|
|
3737
|
+
if (!element) return;
|
|
3738
|
+
const updateSize = (entries)=>setRect(entries[0].contentRect);
|
|
3739
|
+
const observer = new ResizeObserver(updateSize);
|
|
3740
|
+
observer.observe(element);
|
|
3741
|
+
return ()=>{
|
|
3742
|
+
observer.disconnect();
|
|
3743
|
+
};
|
|
3744
|
+
}, [
|
|
3745
|
+
element
|
|
3746
|
+
]);
|
|
3747
|
+
return [
|
|
3748
|
+
ref,
|
|
3749
|
+
rect
|
|
3750
|
+
];
|
|
3751
|
+
}
|
|
3705
3752
|
|
|
3706
3753
|
|
|
3707
3754
|
|
|
@@ -4281,16 +4328,6 @@ const $6efc75079651494a$export$98d9314e6a208b24 = (0, $3Sbms$styledcomponents).d
|
|
|
4281
4328
|
bottom: 0;
|
|
4282
4329
|
cursor: ${(props)=>props.cursor};
|
|
4283
4330
|
transition: all 0.4s;
|
|
4284
|
-
|
|
4285
|
-
${(props)=>{
|
|
4286
|
-
if (props.full) return (0, $3Sbms$css)`
|
|
4287
|
-
width: 100%;
|
|
4288
|
-
height: 100%;
|
|
4289
|
-
right: 0px;
|
|
4290
|
-
padding: 17px 10px;
|
|
4291
|
-
box-sizing: border-box;
|
|
4292
|
-
`;
|
|
4293
|
-
}}
|
|
4294
4331
|
`;
|
|
4295
4332
|
const $6efc75079651494a$export$ba5a75b023bcdce2 = (0, $3Sbms$styledcomponents).div`
|
|
4296
4333
|
display: flex;
|
|
@@ -5142,22 +5179,18 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
|
|
|
5142
5179
|
const { videosContainerRef: videosContainerRef , remoteTilesContainerRef: remoteTilesContainerRef , profile: profile , muted: muted , streaming: streaming , orientation: orientation , options: options , } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
|
|
5143
5180
|
const { streams: streams } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
|
|
5144
5181
|
const [containerWidth, containerHeight] = (0, $af23c74942bdcae7$export$2b86bedf890eab8)(videosContainerRef.current);
|
|
5182
|
+
const cursor = streaming && !extended ? "pointer" : "default";
|
|
5183
|
+
const computedWidth = (0, $b8e10de7c6dba8c4$export$a6112fefa8de799d)({
|
|
5184
|
+
containerWidth: containerWidth,
|
|
5185
|
+
containerHeight: containerHeight,
|
|
5186
|
+
minimumWidth: $5939a59dc7c96d41$var$minimumTileWidth,
|
|
5187
|
+
maximumWidth: $5939a59dc7c96d41$var$maximumTileWidth,
|
|
5188
|
+
orientation: orientation,
|
|
5189
|
+
extended: extended
|
|
5190
|
+
});
|
|
5191
|
+
let tileWidth = `${computedWidth}px`;
|
|
5192
|
+
let tileHeight = `${computedWidth}px`;
|
|
5145
5193
|
const isAlone = streams.length < 1;
|
|
5146
|
-
const cursor = streaming && !isAlone && !extended ? "pointer" : "default";
|
|
5147
|
-
let tileWidth = orientation === "landscape" ? "50%" : "100%";
|
|
5148
|
-
let tileHeight = orientation === "landscape" ? "100%" : "50%";
|
|
5149
|
-
if (!isAlone) {
|
|
5150
|
-
const computedWidth = (0, $b8e10de7c6dba8c4$export$a6112fefa8de799d)({
|
|
5151
|
-
containerWidth: containerWidth,
|
|
5152
|
-
containerHeight: containerHeight,
|
|
5153
|
-
minimumWidth: $5939a59dc7c96d41$var$minimumTileWidth,
|
|
5154
|
-
maximumWidth: $5939a59dc7c96d41$var$maximumTileWidth,
|
|
5155
|
-
orientation: orientation,
|
|
5156
|
-
extended: extended
|
|
5157
|
-
});
|
|
5158
|
-
tileWidth = `${computedWidth}px`;
|
|
5159
|
-
tileHeight = `${computedWidth}px`;
|
|
5160
|
-
}
|
|
5161
5194
|
const onLocalVideoChange = (event)=>{
|
|
5162
5195
|
if (!event.detail?.camera?.device) return;
|
|
5163
5196
|
if (!videoElementRef.current) throw new Error("videoElementRef not available");
|
|
@@ -5167,7 +5200,7 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
|
|
|
5167
5200
|
setZoomAvailable((0, $c9e496369b59be7a$export$2f377c2162fd02b2).isVideoZoomAvailable());
|
|
5168
5201
|
};
|
|
5169
5202
|
const onSelfTileClick = ()=>{
|
|
5170
|
-
if (streaming && !
|
|
5203
|
+
if (streaming && !deviceRequest && !extended && SelfTileRef.current) {
|
|
5171
5204
|
(0, $d02c24b66b4606fd$export$ab7d69e250642927)({
|
|
5172
5205
|
element: SelfTileRef.current
|
|
5173
5206
|
});
|
|
@@ -5235,7 +5268,7 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
|
|
|
5235
5268
|
});
|
|
5236
5269
|
};
|
|
5237
5270
|
const onSelfTileMouseDown = (mouseDownEvent)=>{
|
|
5238
|
-
if (!
|
|
5271
|
+
if (!extended && SelfTileRef.current && videosContainerRef.current) (0, $d02c24b66b4606fd$export$298c6ed7f6695dd6)({
|
|
5239
5272
|
mouseDownEvent: mouseDownEvent,
|
|
5240
5273
|
targetElement: SelfTileRef.current,
|
|
5241
5274
|
containerElement: videosContainerRef.current
|
|
@@ -5260,6 +5293,7 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
|
|
|
5260
5293
|
if (streaming && videoElementRef.current && !videoElementRef.current.srcObject) videoElementRef.current.srcObject = videoMediaProviderRef.current;
|
|
5261
5294
|
}, [
|
|
5262
5295
|
streaming,
|
|
5296
|
+
isAlone,
|
|
5263
5297
|
isSomeonePresenting
|
|
5264
5298
|
]);
|
|
5265
5299
|
(0, $3Sbms$useEffect)(()=>{
|
|
@@ -5270,12 +5304,6 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
|
|
|
5270
5304
|
containerWidth,
|
|
5271
5305
|
containerHeight
|
|
5272
5306
|
]);
|
|
5273
|
-
(0, $3Sbms$useEffect)(()=>{
|
|
5274
|
-
if (isAlone && extended) setExtended(false);
|
|
5275
|
-
}, [
|
|
5276
|
-
isAlone,
|
|
5277
|
-
extended
|
|
5278
|
-
]);
|
|
5279
5307
|
(0, $3Sbms$useEffect)(()=>{
|
|
5280
5308
|
if (!extended) {
|
|
5281
5309
|
setSnapshotAnimation(false);
|
|
@@ -5381,7 +5409,7 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
|
|
|
5381
5409
|
})
|
|
5382
5410
|
]
|
|
5383
5411
|
});
|
|
5384
|
-
if (
|
|
5412
|
+
if (remoteTilesContainerRef?.current && (isAlone || isSomeonePresenting)) return /*#__PURE__*/ (0, $3Sbms$createPortal)(/*#__PURE__*/ (0, $3Sbms$jsx)((0, $7ec04c1818c68245$export$798352b46783b18d), {
|
|
5385
5413
|
style: {
|
|
5386
5414
|
width: `${width}px`,
|
|
5387
5415
|
height: `${height}px`
|
|
@@ -5393,7 +5421,6 @@ const $5939a59dc7c96d41$var$SelfStreamTile = ({ isSomeonePresenting: isSomeonePr
|
|
|
5393
5421
|
children: [
|
|
5394
5422
|
/*#__PURE__*/ (0, $3Sbms$jsxs)((0, $6efc75079651494a$export$98d9314e6a208b24), {
|
|
5395
5423
|
ref: SelfTileRef,
|
|
5396
|
-
full: isAlone,
|
|
5397
5424
|
style: {
|
|
5398
5425
|
width: tileWidth,
|
|
5399
5426
|
height: tileHeight
|
|
@@ -6232,49 +6259,40 @@ var $b496fc6f0d99c06d$export$2e2bcd8739ae039 = $b496fc6f0d99c06d$var$Highlighted
|
|
|
6232
6259
|
|
|
6233
6260
|
|
|
6234
6261
|
|
|
6235
|
-
const $b56218b5a57cb77c$export$d653589df987fd93 = (0, $3Sbms$styledcomponents).div`
|
|
6236
|
-
display: flex;
|
|
6237
|
-
position: absolute;
|
|
6238
|
-
z-index: 20;
|
|
6239
|
-
left: 0;
|
|
6240
|
-
top: 0;
|
|
6241
|
-
transition: all 0.4s;
|
|
6242
|
-
width: ${({ orientation: orientation })=>orientation === "landscape" ? "50%" : "100%"};
|
|
6243
|
-
height: ${({ orientation: orientation })=>orientation === "landscape" ? "100%" : "50%"};
|
|
6244
|
-
padding: 17px 10px;
|
|
6245
|
-
box-sizing: border-box;
|
|
6246
|
-
`;
|
|
6247
6262
|
const $b56218b5a57cb77c$export$dd2ac23a70f320dd = (0, $3Sbms$styledcomponents).div`
|
|
6248
|
-
display: flex;
|
|
6263
|
+
display: ${({ show: show })=>show ? "flex" : "none"};
|
|
6249
6264
|
flex-direction: column;
|
|
6250
6265
|
justify-content: center;
|
|
6251
6266
|
align-items: center;
|
|
6252
6267
|
position: relative;
|
|
6253
|
-
width:
|
|
6254
|
-
height:
|
|
6268
|
+
width: ${({ width: width })=>width};
|
|
6269
|
+
height: ${({ height: height })=>height};
|
|
6255
6270
|
background-color: ${({ theme: theme })=>theme.streamTileBackgroundColor};
|
|
6256
6271
|
border: 2px solid ${({ theme: theme })=>theme.streamTileBorderColor};
|
|
6257
6272
|
border-radius: 20px;
|
|
6258
6273
|
box-sizing: border-box;
|
|
6259
6274
|
color: #fff;
|
|
6260
6275
|
font-family: Lato;
|
|
6276
|
+
padding: 20px;
|
|
6261
6277
|
`;
|
|
6262
6278
|
const $b56218b5a57cb77c$export$2dabfbe763cc7a4 = (0, $3Sbms$styledcomponents).h2`
|
|
6263
6279
|
font-weight: 600;
|
|
6264
6280
|
font-size: 16px;
|
|
6265
6281
|
text-align: center;
|
|
6266
|
-
width: 300px;
|
|
6282
|
+
max-width: 300px;
|
|
6267
6283
|
`;
|
|
6268
6284
|
const $b56218b5a57cb77c$export$6ed6e36e1b456f96 = (0, $3Sbms$styledcomponents).div`
|
|
6269
6285
|
position: relative;
|
|
6270
6286
|
display: flex;
|
|
6271
6287
|
align-items: center;
|
|
6272
6288
|
height: 50px;
|
|
6273
|
-
width:
|
|
6289
|
+
width: 100%;
|
|
6290
|
+
max-width: 300px;
|
|
6274
6291
|
background-color: ${({ theme: theme })=>theme.popupBackgroundSecondaryColor};
|
|
6275
6292
|
border: 1px solid ${({ theme: theme })=>theme.popupBorderColor};
|
|
6276
6293
|
border-radius: 15px;
|
|
6277
6294
|
padding: 0 10px;
|
|
6295
|
+
box-sizing: border-box;
|
|
6278
6296
|
`;
|
|
6279
6297
|
const $b56218b5a57cb77c$export$5f759de1870a3e41 = (0, $3Sbms$styledcomponents).div`
|
|
6280
6298
|
display: flex;
|
|
@@ -6316,7 +6334,7 @@ const $b56218b5a57cb77c$export$d7f3ab4b3437ad97 = (0, $3Sbms$styledcomponents).b
|
|
|
6316
6334
|
const $b56218b5a57cb77c$export$c22678f0e7b404e0 = (0, $3Sbms$styledcomponents).p`
|
|
6317
6335
|
font-size: 12px;
|
|
6318
6336
|
font-weight: 400;
|
|
6319
|
-
width: 300px;
|
|
6337
|
+
max-width: 300px;
|
|
6320
6338
|
text-align: center;
|
|
6321
6339
|
`;
|
|
6322
6340
|
|
|
@@ -6391,11 +6409,14 @@ const $93a0377c243d965e$export$c7df1b15b59b1df2 = /*#__PURE__*/ (0, $3Sbms$jsxs)
|
|
|
6391
6409
|
});
|
|
6392
6410
|
|
|
6393
6411
|
|
|
6394
|
-
|
|
6412
|
+
|
|
6413
|
+
|
|
6414
|
+
const $f0b0b18fe6c6ae77$var$InvitationTile = ({ show: show , orientation: orientation , width: width , height: height })=>{
|
|
6395
6415
|
const { t: t } = (0, $3Sbms$useTranslation)();
|
|
6416
|
+
const { options: options } = (0, $3Sbms$useContext)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039));
|
|
6396
6417
|
const onCopyCallLinkClick = async ()=>{
|
|
6397
6418
|
try {
|
|
6398
|
-
await (0, $57162bcada7d6f66$export$2e2bcd8739ae039)(window.location.href);
|
|
6419
|
+
await (0, $57162bcada7d6f66$export$2e2bcd8739ae039)(options.sharedURL || window.location.href);
|
|
6399
6420
|
(0, $a5146f9062d7bf28$export$3a57e165650c636f)(t("copyLink.copied"), {
|
|
6400
6421
|
duration: 2000
|
|
6401
6422
|
});
|
|
@@ -6406,37 +6427,37 @@ const $f0b0b18fe6c6ae77$var$InvitationTile = ({ orientation: orientation })=>{
|
|
|
6406
6427
|
});
|
|
6407
6428
|
}
|
|
6408
6429
|
};
|
|
6409
|
-
return /*#__PURE__*/ (0, $3Sbms$
|
|
6430
|
+
return /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $b56218b5a57cb77c$export$dd2ac23a70f320dd), {
|
|
6431
|
+
show: show,
|
|
6432
|
+
width: width,
|
|
6433
|
+
height: height,
|
|
6410
6434
|
orientation: orientation,
|
|
6411
|
-
children:
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
})
|
|
6438
|
-
]
|
|
6439
|
-
})
|
|
6435
|
+
children: [
|
|
6436
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$2dabfbe763cc7a4), {
|
|
6437
|
+
children: t("invite.title")
|
|
6438
|
+
}),
|
|
6439
|
+
/*#__PURE__*/ (0, $3Sbms$jsxs)((0, $b56218b5a57cb77c$export$6ed6e36e1b456f96), {
|
|
6440
|
+
children: [
|
|
6441
|
+
/*#__PURE__*/ (0, $3Sbms$jsxs)((0, $b56218b5a57cb77c$export$5f759de1870a3e41), {
|
|
6442
|
+
children: [
|
|
6443
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $1ec1d06e0a21fdaa$export$2e2bcd8739ae039), {
|
|
6444
|
+
color: "black"
|
|
6445
|
+
}),
|
|
6446
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$c6b180e8ec79154e), {
|
|
6447
|
+
children: options.sharedURL || window.location.href
|
|
6448
|
+
})
|
|
6449
|
+
]
|
|
6450
|
+
}),
|
|
6451
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$d7f3ab4b3437ad97), {
|
|
6452
|
+
onClick: onCopyCallLinkClick,
|
|
6453
|
+
children: t("invite.copy")
|
|
6454
|
+
})
|
|
6455
|
+
]
|
|
6456
|
+
}),
|
|
6457
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $b56218b5a57cb77c$export$c22678f0e7b404e0), {
|
|
6458
|
+
children: t("invite.description")
|
|
6459
|
+
})
|
|
6460
|
+
]
|
|
6440
6461
|
});
|
|
6441
6462
|
};
|
|
6442
6463
|
var $f0b0b18fe6c6ae77$export$2e2bcd8739ae039 = $f0b0b18fe6c6ae77$var$InvitationTile;
|
|
@@ -6515,6 +6536,7 @@ const $cdab47bb8796991e$var$Video = ()=>{
|
|
|
6515
6536
|
});
|
|
6516
6537
|
const { streams: streams , highlightedTile: highlightedTile , dispatch: dispatch } = (0, $cce9fd41d8a55a18$export$b5633a7cfbe42d9f)();
|
|
6517
6538
|
const [containerWidth, containerHeight] = (0, $af23c74942bdcae7$export$2b86bedf890eab8)(remoteTilesContainerRef.current);
|
|
6539
|
+
const showInvitation = !options.audioTiles && streams.length < 1 && !highlightedTile && containerWidth > 0;
|
|
6518
6540
|
(0, $3Sbms$useEffect)(()=>{
|
|
6519
6541
|
if (options.GDPRDisclaimer) (0, $b8963bf62cf5b984$export$2e2bcd8739ae039)({
|
|
6520
6542
|
message: "Para mejorar la calidad de nuestro servicio, esta llamada ser\xe1 grabada",
|
|
@@ -6525,9 +6547,10 @@ const $cdab47bb8796991e$var$Video = ()=>{
|
|
|
6525
6547
|
options.GDPRDisclaimer
|
|
6526
6548
|
]);
|
|
6527
6549
|
(0, $3Sbms$useEffect)(()=>{
|
|
6528
|
-
if (remoteTilesContainerRef?.current
|
|
6550
|
+
if (remoteTilesContainerRef?.current) {
|
|
6529
6551
|
const ratio = 1;
|
|
6530
|
-
|
|
6552
|
+
let numberOfTiles = remoteTilesContainerRef.current.childElementCount;
|
|
6553
|
+
if (!showInvitation) numberOfTiles -= 1;
|
|
6531
6554
|
const videoWidth = (0, $b8e10de7c6dba8c4$export$4d43009c33055644)({
|
|
6532
6555
|
availableWidth: containerWidth - 16 * (numberOfTiles - 1),
|
|
6533
6556
|
availableHeight: containerHeight - 16 * (numberOfTiles - 1),
|
|
@@ -6545,15 +6568,17 @@ const $cdab47bb8796991e$var$Video = ()=>{
|
|
|
6545
6568
|
containerWidth,
|
|
6546
6569
|
containerHeight,
|
|
6547
6570
|
streams.length,
|
|
6548
|
-
highlightedTile
|
|
6571
|
+
highlightedTile,
|
|
6572
|
+
showInvitation,
|
|
6549
6573
|
]);
|
|
6550
6574
|
(0, $3Sbms$useEffect)(()=>{
|
|
6551
6575
|
if (userInteractionTriggered) {
|
|
6552
6576
|
if (options.controls?.microphone?.enabled) (0, $c9e496369b59be7a$export$2f377c2162fd02b2).enableMicrophone();
|
|
6553
|
-
if (options.controls?.camera?.enabled) (0, $c9e496369b59be7a$export$2f377c2162fd02b2).enableVideo();
|
|
6577
|
+
if (options.controls?.camera?.enabled && !options.audioTiles) (0, $c9e496369b59be7a$export$2f377c2162fd02b2).enableVideo();
|
|
6554
6578
|
}
|
|
6555
6579
|
}, [
|
|
6556
6580
|
options.controls,
|
|
6581
|
+
options.audioTiles,
|
|
6557
6582
|
userInteractionTriggered
|
|
6558
6583
|
]);
|
|
6559
6584
|
(0, $3Sbms$useEffect)(()=>{
|
|
@@ -6699,7 +6724,10 @@ const $cdab47bb8796991e$var$Video = ()=>{
|
|
|
6699
6724
|
height: tileSize.height
|
|
6700
6725
|
}, stream.id);
|
|
6701
6726
|
}),
|
|
6702
|
-
|
|
6727
|
+
/*#__PURE__*/ (0, $3Sbms$jsx)((0, $f0b0b18fe6c6ae77$export$2e2bcd8739ae039), {
|
|
6728
|
+
show: showInvitation,
|
|
6729
|
+
width: `${tileSize.width}px`,
|
|
6730
|
+
height: `${tileSize.height}px`,
|
|
6703
6731
|
orientation: orientation
|
|
6704
6732
|
})
|
|
6705
6733
|
]
|
|
@@ -9068,38 +9096,38 @@ const $d493afe60dcea711$var$backgroundOptions = [
|
|
|
9068
9096
|
{
|
|
9069
9097
|
title: "Blue",
|
|
9070
9098
|
id: "background-blue",
|
|
9071
|
-
iconUrl: `${"https://stream-assets.snapcall.io
|
|
9072
|
-
value: `${"https://stream-assets.snapcall.io
|
|
9099
|
+
iconUrl: `${"https://stream-assets.snapcall.io"}/backgrounds/blue_background_icon.png`,
|
|
9100
|
+
value: `${"https://stream-assets.snapcall.io"}/backgrounds/blue_background.png`
|
|
9073
9101
|
},
|
|
9074
9102
|
{
|
|
9075
9103
|
title: "Cold",
|
|
9076
9104
|
id: "background-cold",
|
|
9077
|
-
iconUrl: `${"https://stream-assets.snapcall.io
|
|
9078
|
-
value: `${"https://stream-assets.snapcall.io
|
|
9105
|
+
iconUrl: `${"https://stream-assets.snapcall.io"}/backgrounds/cold_background_icon.png`,
|
|
9106
|
+
value: `${"https://stream-assets.snapcall.io"}/backgrounds/cold_background.png`
|
|
9079
9107
|
},
|
|
9080
9108
|
{
|
|
9081
9109
|
title: "Bricks",
|
|
9082
9110
|
id: "background-bricks",
|
|
9083
|
-
iconUrl: `${"https://stream-assets.snapcall.io
|
|
9084
|
-
value: `${"https://stream-assets.snapcall.io
|
|
9111
|
+
iconUrl: `${"https://stream-assets.snapcall.io"}/backgrounds/bricks_background_icon.png`,
|
|
9112
|
+
value: `${"https://stream-assets.snapcall.io"}/backgrounds/bricks_background.png`
|
|
9085
9113
|
},
|
|
9086
9114
|
{
|
|
9087
9115
|
title: "White",
|
|
9088
9116
|
id: "background-white",
|
|
9089
|
-
iconUrl: `${"https://stream-assets.snapcall.io
|
|
9090
|
-
value: `${"https://stream-assets.snapcall.io
|
|
9117
|
+
iconUrl: `${"https://stream-assets.snapcall.io"}/backgrounds/white_background_icon.png`,
|
|
9118
|
+
value: `${"https://stream-assets.snapcall.io"}/backgrounds/white_background.png`
|
|
9091
9119
|
},
|
|
9092
9120
|
{
|
|
9093
9121
|
title: "Yellow",
|
|
9094
9122
|
id: "background-yellow",
|
|
9095
|
-
iconUrl: `${"https://stream-assets.snapcall.io
|
|
9096
|
-
value: `${"https://stream-assets.snapcall.io
|
|
9123
|
+
iconUrl: `${"https://stream-assets.snapcall.io"}/backgrounds/yellow_background_icon.png`,
|
|
9124
|
+
value: `${"https://stream-assets.snapcall.io"}/backgrounds/yellow_background.png`
|
|
9097
9125
|
},
|
|
9098
9126
|
{
|
|
9099
9127
|
title: "Warm",
|
|
9100
9128
|
id: "background-warm",
|
|
9101
|
-
iconUrl: `${"https://stream-assets.snapcall.io
|
|
9102
|
-
value: `${"https://stream-assets.snapcall.io
|
|
9129
|
+
iconUrl: `${"https://stream-assets.snapcall.io"}/backgrounds/warm_background_icon.png`,
|
|
9130
|
+
value: `${"https://stream-assets.snapcall.io"}/backgrounds/warm_background.png`
|
|
9103
9131
|
},
|
|
9104
9132
|
{
|
|
9105
9133
|
title: "None",
|
|
@@ -9992,20 +10020,22 @@ const $15a01b611391c1e7$var$audioSource = new Blob([
|
|
|
9992
10020
|
const $15a01b611391c1e7$var$audioURL = URL.createObjectURL($15a01b611391c1e7$var$audioSource);
|
|
9993
10021
|
let $15a01b611391c1e7$var$mediaResult = undefined;
|
|
9994
10022
|
const $15a01b611391c1e7$export$716eeec86fd18da7 = ()=>{
|
|
9995
|
-
$15a01b611391c1e7$var$mediaResult?.
|
|
10023
|
+
$15a01b611391c1e7$var$mediaResult?.getTracks().forEach((track)=>{
|
|
9996
10024
|
track.stop();
|
|
9997
10025
|
});
|
|
9998
10026
|
$15a01b611391c1e7$var$mediaResult = undefined;
|
|
9999
10027
|
};
|
|
10000
|
-
const $15a01b611391c1e7$export$494039379563c94d = async ()=>{
|
|
10028
|
+
const $15a01b611391c1e7$export$494039379563c94d = async (options)=>{
|
|
10001
10029
|
try {
|
|
10002
10030
|
const audioObject = new Audio($15a01b611391c1e7$var$audioURL);
|
|
10003
10031
|
await audioObject.play();
|
|
10004
10032
|
} catch (err) {
|
|
10005
10033
|
console.warn("User interaction is required, asking audio GUM");
|
|
10006
10034
|
$15a01b611391c1e7$var$mediaResult = await navigator.mediaDevices.getUserMedia({
|
|
10007
|
-
audio: true
|
|
10035
|
+
audio: true,
|
|
10036
|
+
video: !options.audioTiles
|
|
10008
10037
|
});
|
|
10038
|
+
$15a01b611391c1e7$var$mediaResult.getVideoTracks().forEach((track)=>track.stop());
|
|
10009
10039
|
}
|
|
10010
10040
|
};
|
|
10011
10041
|
|
|
@@ -10110,17 +10140,6 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
|
|
|
10110
10140
|
const [isBlockedDevicesPopupOpen, setBlockedDevicesPopupOpen] = (0, $3Sbms$useState)(false);
|
|
10111
10141
|
const orientation = (containerWidth || window.screen.width) > (containerHeight || window.screen.height) ? "landscape" : "portrait";
|
|
10112
10142
|
const styledTheme = theme === "dark" ? (0, $52580db2e49cdd90$export$3e936a8db52a10a0) : (0, $52580db2e49cdd90$export$f30cb9bc4f736419);
|
|
10113
|
-
const onEnterRoom = async (event)=>{
|
|
10114
|
-
const peerId = event.detail.peerId;
|
|
10115
|
-
setSelfPeerId(peerId);
|
|
10116
|
-
try {
|
|
10117
|
-
await (0, $15a01b611391c1e7$export$494039379563c94d)();
|
|
10118
|
-
setUserInteractionTriggered(true);
|
|
10119
|
-
} catch (userInteractionError) {
|
|
10120
|
-
setBlockedDevicesPopupOpen(true);
|
|
10121
|
-
console.error("User interaction trigger failed", userInteractionError);
|
|
10122
|
-
}
|
|
10123
|
-
};
|
|
10124
10143
|
const onWebcamUpdate = (event)=>{
|
|
10125
10144
|
if (event.type === "localVideoAvailable") setStreaming(true);
|
|
10126
10145
|
else setStreaming(false);
|
|
@@ -10213,7 +10232,6 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
|
|
|
10213
10232
|
language
|
|
10214
10233
|
]);
|
|
10215
10234
|
(0, $3Sbms$useEffect)(()=>{
|
|
10216
|
-
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("enterRoom", onEnterRoom);
|
|
10217
10235
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("localVideoAvailable", onWebcamUpdate);
|
|
10218
10236
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("localVideoUnavailable", onWebcamUpdate);
|
|
10219
10237
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("screenshareEnabled", onScreenshareUpdate);
|
|
@@ -10229,7 +10247,6 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
|
|
|
10229
10247
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("agentIdentity", onAgentIdentity);
|
|
10230
10248
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("criticalError", onCriticalError);
|
|
10231
10249
|
return ()=>{
|
|
10232
|
-
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("enterRoom", onEnterRoom);
|
|
10233
10250
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("localVideoAvailable", onWebcamUpdate);
|
|
10234
10251
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("localVideoUnavailable", onWebcamUpdate);
|
|
10235
10252
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("screenshareEnabled", onScreenshareUpdate);
|
|
@@ -10246,6 +10263,25 @@ const $26ed036cbc17809a$var$StreamUI = ({ options: options })=>{
|
|
|
10246
10263
|
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("criticalError", onCriticalError);
|
|
10247
10264
|
};
|
|
10248
10265
|
}, []);
|
|
10266
|
+
(0, $3Sbms$useEffect)(()=>{
|
|
10267
|
+
const onEnterRoom = async (event)=>{
|
|
10268
|
+
const peerId = event.detail.peerId;
|
|
10269
|
+
setSelfPeerId(peerId);
|
|
10270
|
+
try {
|
|
10271
|
+
await (0, $15a01b611391c1e7$export$494039379563c94d)(options);
|
|
10272
|
+
setUserInteractionTriggered(true);
|
|
10273
|
+
} catch (userInteractionError) {
|
|
10274
|
+
setBlockedDevicesPopupOpen(true);
|
|
10275
|
+
console.error("User interaction trigger failed", userInteractionError);
|
|
10276
|
+
}
|
|
10277
|
+
};
|
|
10278
|
+
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).addEventListener("enterRoom", onEnterRoom);
|
|
10279
|
+
return ()=>{
|
|
10280
|
+
(0, $c9e496369b59be7a$export$2f377c2162fd02b2).removeEventListener("enterRoom", onEnterRoom);
|
|
10281
|
+
};
|
|
10282
|
+
}, [
|
|
10283
|
+
options
|
|
10284
|
+
]);
|
|
10249
10285
|
return /*#__PURE__*/ (0, $3Sbms$jsx)((0, $5f30d8bf4f04621e$export$2e2bcd8739ae039).Provider, {
|
|
10250
10286
|
value: {
|
|
10251
10287
|
selfPeerId: selfPeerId,
|
|
@@ -10327,7 +10363,6 @@ window.hj = window.hj || function() {
|
|
|
10327
10363
|
|
|
10328
10364
|
|
|
10329
10365
|
|
|
10330
|
-
|
|
10331
10366
|
const $9a3d651cab8c9249$var$GreetingSnapcallLogo = ()=>{
|
|
10332
10367
|
return /*#__PURE__*/ (0, $3Sbms$jsx)("svg", {
|
|
10333
10368
|
width: "72",
|
|
@@ -10559,90 +10594,87 @@ const $35c6a4b506b7dc62$export$d4a1a815e49dfefd = (0, $3Sbms$styledcomponents).d
|
|
|
10559
10594
|
|
|
10560
10595
|
|
|
10561
10596
|
|
|
10562
|
-
|
|
10563
|
-
try {
|
|
10564
|
-
const stream = navigator.mediaDevices.getUserMedia({
|
|
10565
|
-
video: device === "webcam",
|
|
10566
|
-
audio: device === "microphone"
|
|
10567
|
-
});
|
|
10568
|
-
return stream;
|
|
10569
|
-
} catch (err) {
|
|
10570
|
-
console.error("Get User Media Failed: ", err);
|
|
10571
|
-
return null;
|
|
10572
|
-
}
|
|
10573
|
-
};
|
|
10574
|
-
let $f8d57e3d223f5089$var$videoTrack;
|
|
10597
|
+
|
|
10575
10598
|
const $f8d57e3d223f5089$var$GreetingView = ({ onGreetingDone: onGreetingDone })=>{
|
|
10576
10599
|
const { t: t } = (0, $3Sbms$useTranslation)();
|
|
10577
|
-
const mainContainerRef = (0, $
|
|
10578
|
-
const videoRef = (0, $3Sbms$useRef)(null);
|
|
10600
|
+
const [mainContainerRef, { width: width , height: height }] = (0, $af23c74942bdcae7$export$e295b0c537d32d7d)();
|
|
10579
10601
|
const inputRef = (0, $3Sbms$useRef)(null);
|
|
10580
|
-
const
|
|
10581
|
-
const [
|
|
10602
|
+
const videoRef = (0, $3Sbms$useRef)(null);
|
|
10603
|
+
const [videoTrack1, setVideoTrack] = (0, $3Sbms$useState)(undefined);
|
|
10582
10604
|
const [micEnabled, setMicEnabled] = (0, $3Sbms$useState)(false);
|
|
10583
10605
|
const [joining, setJoining] = (0, $3Sbms$useState)(false);
|
|
10584
|
-
const [firstRender, setFirstRender] = (0, $3Sbms$useState)(true);
|
|
10585
|
-
const [width, height] = (0, $af23c74942bdcae7$export$2b86bedf890eab8)(mainContainerRef.current);
|
|
10586
10606
|
const desktop = width >= height;
|
|
10587
10607
|
const onSubmit = ()=>{
|
|
10588
10608
|
const displayName = inputRef.current?.value;
|
|
10609
|
+
const cameraEnabled = Boolean(videoTrack1);
|
|
10610
|
+
videoTrack1?.stop();
|
|
10589
10611
|
setJoining(true);
|
|
10590
10612
|
setTimeout(()=>{
|
|
10591
10613
|
onGreetingDone({
|
|
10592
|
-
cameraEnabled:
|
|
10614
|
+
cameraEnabled: cameraEnabled,
|
|
10593
10615
|
micEnabled: micEnabled,
|
|
10594
10616
|
displayName: displayName
|
|
10595
10617
|
});
|
|
10596
10618
|
}, 4000);
|
|
10597
10619
|
};
|
|
10598
|
-
const
|
|
10599
|
-
|
|
10600
|
-
|
|
10601
|
-
|
|
10602
|
-
stream.
|
|
10603
|
-
|
|
10604
|
-
if (
|
|
10620
|
+
const getUserMedia = async (opt)=>{
|
|
10621
|
+
try {
|
|
10622
|
+
const stream = await navigator.mediaDevices.getUserMedia(opt);
|
|
10623
|
+
const videoTrack = stream.getVideoTracks()[0];
|
|
10624
|
+
const audioTrack = stream.getAudioTracks()[0];
|
|
10625
|
+
if (videoTrack) setVideoTrack(videoTrack);
|
|
10626
|
+
if (audioTrack) setMicEnabled(true);
|
|
10627
|
+
audioTrack?.stop();
|
|
10628
|
+
} catch (err) {
|
|
10629
|
+
console.error("Get User Media Failed: ", err);
|
|
10630
|
+
}
|
|
10631
|
+
};
|
|
10632
|
+
const onCameraClick = (0, $3Sbms$useCallback)(async ()=>{
|
|
10633
|
+
if (!videoTrack1) await getUserMedia({
|
|
10634
|
+
video: true
|
|
10605
10635
|
});
|
|
10606
10636
|
else {
|
|
10607
|
-
|
|
10608
|
-
|
|
10609
|
-
setWebcamEnabled(false);
|
|
10637
|
+
videoTrack1.stop();
|
|
10638
|
+
setVideoTrack(undefined);
|
|
10610
10639
|
}
|
|
10611
10640
|
}, [
|
|
10612
|
-
|
|
10613
|
-
stream
|
|
10641
|
+
videoTrack1
|
|
10614
10642
|
]);
|
|
10615
10643
|
const onMicrophoneClick = (0, $3Sbms$useCallback)(async ()=>{
|
|
10616
|
-
if (!micEnabled)
|
|
10617
|
-
|
|
10618
|
-
setMicEnabled(true);
|
|
10644
|
+
if (!micEnabled) await getUserMedia({
|
|
10645
|
+
audio: true
|
|
10619
10646
|
});
|
|
10620
10647
|
else setMicEnabled(false);
|
|
10621
10648
|
}, [
|
|
10622
10649
|
micEnabled
|
|
10623
10650
|
]);
|
|
10624
10651
|
(0, $3Sbms$useEffect)(()=>{
|
|
10625
|
-
if (
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
console.error("Error: ", err);
|
|
10631
|
-
} finally{
|
|
10632
|
-
setFirstRender(false);
|
|
10652
|
+
if (videoRef.current) {
|
|
10653
|
+
if (videoTrack1) videoRef.current.srcObject = new MediaStream([
|
|
10654
|
+
videoTrack1
|
|
10655
|
+
]);
|
|
10656
|
+
else videoRef.current.srcObject = null;
|
|
10633
10657
|
}
|
|
10634
10658
|
}, [
|
|
10635
|
-
|
|
10636
|
-
|
|
10637
|
-
|
|
10659
|
+
videoRef,
|
|
10660
|
+
videoTrack1,
|
|
10661
|
+
width,
|
|
10662
|
+
height
|
|
10638
10663
|
]);
|
|
10664
|
+
(0, $3Sbms$useEffect)(()=>{
|
|
10665
|
+
getUserMedia({
|
|
10666
|
+
audio: true,
|
|
10667
|
+
video: true
|
|
10668
|
+
});
|
|
10669
|
+
}, []);
|
|
10639
10670
|
if (joining === true) return /*#__PURE__*/ (0, $3Sbms$jsx)((0, $35c6a4b506b7dc62$export$d4a1a815e49dfefd), {
|
|
10640
10671
|
children: /*#__PURE__*/ (0, $3Sbms$jsx)("img", {
|
|
10641
|
-
src: `${"https://stream-assets.snapcall.io
|
|
10672
|
+
src: `${"https://stream-assets.snapcall.io"}/animations/snapcall-logo-animation.gif`,
|
|
10642
10673
|
alt: "Snapcall logo animation",
|
|
10643
10674
|
height: 40
|
|
10644
10675
|
})
|
|
10645
10676
|
});
|
|
10677
|
+
const webcamEnabled = Boolean(videoTrack1);
|
|
10646
10678
|
return /*#__PURE__*/ (0, $3Sbms$jsxs)((0, $35c6a4b506b7dc62$export$d653589df987fd93), {
|
|
10647
10679
|
ref: mainContainerRef,
|
|
10648
10680
|
children: [
|