@snapcall/stream-ui 1.41.1 → 1.41.3-beta.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 +34 -21
- package/dist/stream-ui.js +34 -21
- package/package.json +1 -2
package/dist/stream-ui.esm.js
CHANGED
|
@@ -13,7 +13,6 @@ import {v4 as $3Sbms$v4} from "uuid";
|
|
|
13
13
|
import {WebSocketTransport as $3Sbms$WebSocketTransport, Peer as $3Sbms$Peer} from "protoo-client";
|
|
14
14
|
import {Device as $3Sbms$Device} from "mediasoup-client";
|
|
15
15
|
import {Buffer as $3Sbms$Buffer} from "buffer";
|
|
16
|
-
import {SelfieSegmentation as $3Sbms$SelfieSegmentation} from "@mediapipe/selfie_segmentation";
|
|
17
16
|
import "./timer.43cfcbcc.js";
|
|
18
17
|
import {Form as $3Sbms$Form, FormField as $3Sbms$FormField, FormItem as $3Sbms$FormItem, FormLabel as $3Sbms$FormLabel, FormControl as $3Sbms$FormControl, FormMessage as $3Sbms$FormMessage} from "@snapcall/design-system/form";
|
|
19
18
|
import {useForm as $3Sbms$useForm} from "react-hook-form";
|
|
@@ -1463,18 +1462,31 @@ class $18e7e050e6a491e3$export$2e2bcd8739ae039 {
|
|
|
1463
1462
|
|
|
1464
1463
|
|
|
1465
1464
|
|
|
1466
|
-
|
|
1467
1465
|
const $0148b6fd862a22e8$var$log = new (0, $0f65a9eaf4a1e910$export$2e2bcd8739ae039)('MediaPipe');
|
|
1468
1466
|
const $0148b6fd862a22e8$var$mediapipeUrl = "https://stream-assets.snapcall.io";
|
|
1469
1467
|
let $0148b6fd862a22e8$var$selfieSegmentationInitialized = false;
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1468
|
+
let $0148b6fd862a22e8$var$selfieSegmentation;
|
|
1469
|
+
async function $0148b6fd862a22e8$var$initSelfieSegmentation() {
|
|
1470
|
+
await new Promise((resolve)=>{
|
|
1471
|
+
const script = document.createElement('script');
|
|
1472
|
+
script.src = `${$0148b6fd862a22e8$var$mediapipeUrl}/mediapipe/selfie_segmentation.js`;
|
|
1473
|
+
script.onload = resolve;
|
|
1474
|
+
document.head.appendChild(script);
|
|
1475
|
+
});
|
|
1476
|
+
console.log('selfieSegmentation script loaded');
|
|
1477
|
+
$0148b6fd862a22e8$var$selfieSegmentation = new window.SelfieSegmentation({
|
|
1478
|
+
locateFile: (file, prefix)=>{
|
|
1479
|
+
$0148b6fd862a22e8$var$log.debug('selfieSegmentation', file, prefix);
|
|
1480
|
+
if ($0148b6fd862a22e8$var$mediapipeUrl) return `${$0148b6fd862a22e8$var$mediapipeUrl}/mediapipe/${file}`;
|
|
1481
|
+
const url = window.location.href;
|
|
1482
|
+
const path = url.split('/').slice(0, -1).join('/');
|
|
1483
|
+
return `${path}/mediapipe/${file}`;
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
console.log('selfieSegmentation initialized', $0148b6fd862a22e8$var$selfieSegmentation);
|
|
1487
|
+
}
|
|
1488
|
+
$0148b6fd862a22e8$var$initSelfieSegmentation().catch((err)=>{
|
|
1489
|
+
$0148b6fd862a22e8$var$log.error('initSelfieSegmentation', 'error', err);
|
|
1478
1490
|
});
|
|
1479
1491
|
class $0148b6fd862a22e8$export$2e2bcd8739ae039 {
|
|
1480
1492
|
constructor(stream, options){
|
|
@@ -1555,7 +1567,7 @@ class $0148b6fd862a22e8$export$2e2bcd8739ae039 {
|
|
|
1555
1567
|
}
|
|
1556
1568
|
runWithFrameCallback() {
|
|
1557
1569
|
if (this.live) this.image.requestVideoFrameCallback(()=>{
|
|
1558
|
-
$0148b6fd862a22e8$var$selfieSegmentation
|
|
1570
|
+
$0148b6fd862a22e8$var$selfieSegmentation?.send({
|
|
1559
1571
|
image: this.image
|
|
1560
1572
|
});
|
|
1561
1573
|
this.runWithFrameCallback();
|
|
@@ -1567,21 +1579,21 @@ class $0148b6fd862a22e8$export$2e2bcd8739ae039 {
|
|
|
1567
1579
|
selfieMode: false,
|
|
1568
1580
|
modelSelection: 0
|
|
1569
1581
|
};
|
|
1570
|
-
$0148b6fd862a22e8$var$selfieSegmentation
|
|
1582
|
+
$0148b6fd862a22e8$var$selfieSegmentation?.setOptions(option);
|
|
1571
1583
|
$0148b6fd862a22e8$var$log.log('selfie segmentation initialized');
|
|
1572
1584
|
if (!$0148b6fd862a22e8$var$selfieSegmentationInitialized) {
|
|
1573
|
-
await $0148b6fd862a22e8$var$selfieSegmentation
|
|
1585
|
+
await $0148b6fd862a22e8$var$selfieSegmentation?.initialize();
|
|
1574
1586
|
$0148b6fd862a22e8$var$selfieSegmentationInitialized = true;
|
|
1575
1587
|
}
|
|
1576
1588
|
this.image.srcObject = this.stream;
|
|
1577
1589
|
this.image.onplay = async ()=>{
|
|
1578
1590
|
this.live = true;
|
|
1579
1591
|
try {
|
|
1580
|
-
$0148b6fd862a22e8$var$selfieSegmentation
|
|
1592
|
+
$0148b6fd862a22e8$var$selfieSegmentation?.onResults((res)=>{
|
|
1581
1593
|
this.onFrame(res);
|
|
1582
1594
|
});
|
|
1583
1595
|
this.timerWorker.onmessage = ()=>{
|
|
1584
|
-
$0148b6fd862a22e8$var$selfieSegmentation
|
|
1596
|
+
$0148b6fd862a22e8$var$selfieSegmentation?.send({
|
|
1585
1597
|
image: this.image
|
|
1586
1598
|
});
|
|
1587
1599
|
};
|
|
@@ -5292,7 +5304,7 @@ const $5df4888ed259ef8a$export$3e37751cffc31fd8 = [
|
|
|
5292
5304
|
|
|
5293
5305
|
|
|
5294
5306
|
|
|
5295
|
-
const $2a1d7886742be527$var$mixpanelToken =
|
|
5307
|
+
const $2a1d7886742be527$var$mixpanelToken = undefined;
|
|
5296
5308
|
const $2a1d7886742be527$export$18c6473b5b45bda1 = $2a1d7886742be527$var$mixpanelToken ? (0, $3Sbms$mixpanelbrowsersrcloadersloadermodulecore).init($2a1d7886742be527$var$mixpanelToken, {
|
|
5297
5309
|
track_pageview: false,
|
|
5298
5310
|
autocapture: false
|
|
@@ -10062,12 +10074,12 @@ const $0bd5dc59be85fdb8$export$aab864ee9e2aed8d = ()=>{
|
|
|
10062
10074
|
},
|
|
10063
10075
|
children: /*#__PURE__*/ (0, $3Sbms$jsx)((0, $3Sbms$TabsList), {
|
|
10064
10076
|
className: (0, $3Sbms$classnames)('flex w-full border border-black/10 rounded-2xl backdrop-blur-[20px]', hasVideo ? 'bg-gray-25/50' : 'bg-gray-50'),
|
|
10065
|
-
children: availableModes.map((
|
|
10077
|
+
children: availableModes.map((availableMode)=>/*#__PURE__*/ (0, $3Sbms$jsx)((0, $3Sbms$TabsTrigger), {
|
|
10066
10078
|
className: (0, $3Sbms$classnames)('flex-1 rounded-xl text-black dark:data-[state=active]:text-white data-[state=active]:bg-black', hasVideo ? 'hover:bg-black/5' : 'hover:bg-gray-200'),
|
|
10067
|
-
value:
|
|
10068
|
-
disabled: devicesState.data?.isAskingPermissions,
|
|
10069
|
-
children:
|
|
10070
|
-
},
|
|
10079
|
+
value: availableMode.value,
|
|
10080
|
+
disabled: devicesState.data?.isAskingPermissions && !(mode === 'upload' || mode === 'screen'),
|
|
10081
|
+
children: availableMode.title
|
|
10082
|
+
}, availableMode.value))
|
|
10071
10083
|
})
|
|
10072
10084
|
})
|
|
10073
10085
|
});
|
|
@@ -11229,6 +11241,7 @@ const $c17ed5e6f3ec1094$export$60c4050edc47776a = ({ streamToken: streamToken, o
|
|
|
11229
11241
|
},
|
|
11230
11242
|
onMessage: (message, payload)=>{
|
|
11231
11243
|
if (message === 'idCheck.onApplicantVerificationCompleted' && // @ts-expect-error invalid lib types
|
|
11244
|
+
payload.reviewResult.reviewAnswer === 'GREEN' || message === 'idCheck.onApplicantStatusChanged' && // @ts-expect-error invalid lib types
|
|
11232
11245
|
payload.reviewResult.reviewAnswer === 'GREEN') setTimeout(()=>{
|
|
11233
11246
|
onSuccess?.();
|
|
11234
11247
|
}, 1500);
|
package/dist/stream-ui.js
CHANGED
|
@@ -13,7 +13,6 @@ var $jQDcL$uuid = require("uuid");
|
|
|
13
13
|
var $jQDcL$protooclient = require("protoo-client");
|
|
14
14
|
var $jQDcL$mediasoupclient = require("mediasoup-client");
|
|
15
15
|
var $jQDcL$buffer = require("buffer");
|
|
16
|
-
var $jQDcL$mediapipeselfie_segmentation = require("@mediapipe/selfie_segmentation");
|
|
17
16
|
require("./timer.fd5ed46d.js");
|
|
18
17
|
var $jQDcL$snapcalldesignsystemform = require("@snapcall/design-system/form");
|
|
19
18
|
var $jQDcL$reacthookform = require("react-hook-form");
|
|
@@ -1469,18 +1468,31 @@ class $4d8706730e116a0d$export$2e2bcd8739ae039 {
|
|
|
1469
1468
|
|
|
1470
1469
|
|
|
1471
1470
|
|
|
1472
|
-
|
|
1473
1471
|
const $cb913ea078a876a6$var$log = new (0, $d0c6baf97675ab49$export$2e2bcd8739ae039)('MediaPipe');
|
|
1474
1472
|
const $cb913ea078a876a6$var$mediapipeUrl = "https://stream-assets.snapcall.io";
|
|
1475
1473
|
let $cb913ea078a876a6$var$selfieSegmentationInitialized = false;
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
}
|
|
1474
|
+
let $cb913ea078a876a6$var$selfieSegmentation;
|
|
1475
|
+
async function $cb913ea078a876a6$var$initSelfieSegmentation() {
|
|
1476
|
+
await new Promise((resolve)=>{
|
|
1477
|
+
const script = document.createElement('script');
|
|
1478
|
+
script.src = `${$cb913ea078a876a6$var$mediapipeUrl}/mediapipe/selfie_segmentation.js`;
|
|
1479
|
+
script.onload = resolve;
|
|
1480
|
+
document.head.appendChild(script);
|
|
1481
|
+
});
|
|
1482
|
+
console.log('selfieSegmentation script loaded');
|
|
1483
|
+
$cb913ea078a876a6$var$selfieSegmentation = new window.SelfieSegmentation({
|
|
1484
|
+
locateFile: (file, prefix)=>{
|
|
1485
|
+
$cb913ea078a876a6$var$log.debug('selfieSegmentation', file, prefix);
|
|
1486
|
+
if ($cb913ea078a876a6$var$mediapipeUrl) return `${$cb913ea078a876a6$var$mediapipeUrl}/mediapipe/${file}`;
|
|
1487
|
+
const url = window.location.href;
|
|
1488
|
+
const path = url.split('/').slice(0, -1).join('/');
|
|
1489
|
+
return `${path}/mediapipe/${file}`;
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
console.log('selfieSegmentation initialized', $cb913ea078a876a6$var$selfieSegmentation);
|
|
1493
|
+
}
|
|
1494
|
+
$cb913ea078a876a6$var$initSelfieSegmentation().catch((err)=>{
|
|
1495
|
+
$cb913ea078a876a6$var$log.error('initSelfieSegmentation', 'error', err);
|
|
1484
1496
|
});
|
|
1485
1497
|
class $cb913ea078a876a6$export$2e2bcd8739ae039 {
|
|
1486
1498
|
constructor(stream, options){
|
|
@@ -1561,7 +1573,7 @@ class $cb913ea078a876a6$export$2e2bcd8739ae039 {
|
|
|
1561
1573
|
}
|
|
1562
1574
|
runWithFrameCallback() {
|
|
1563
1575
|
if (this.live) this.image.requestVideoFrameCallback(()=>{
|
|
1564
|
-
$cb913ea078a876a6$var$selfieSegmentation
|
|
1576
|
+
$cb913ea078a876a6$var$selfieSegmentation?.send({
|
|
1565
1577
|
image: this.image
|
|
1566
1578
|
});
|
|
1567
1579
|
this.runWithFrameCallback();
|
|
@@ -1573,21 +1585,21 @@ class $cb913ea078a876a6$export$2e2bcd8739ae039 {
|
|
|
1573
1585
|
selfieMode: false,
|
|
1574
1586
|
modelSelection: 0
|
|
1575
1587
|
};
|
|
1576
|
-
$cb913ea078a876a6$var$selfieSegmentation
|
|
1588
|
+
$cb913ea078a876a6$var$selfieSegmentation?.setOptions(option);
|
|
1577
1589
|
$cb913ea078a876a6$var$log.log('selfie segmentation initialized');
|
|
1578
1590
|
if (!$cb913ea078a876a6$var$selfieSegmentationInitialized) {
|
|
1579
|
-
await $cb913ea078a876a6$var$selfieSegmentation
|
|
1591
|
+
await $cb913ea078a876a6$var$selfieSegmentation?.initialize();
|
|
1580
1592
|
$cb913ea078a876a6$var$selfieSegmentationInitialized = true;
|
|
1581
1593
|
}
|
|
1582
1594
|
this.image.srcObject = this.stream;
|
|
1583
1595
|
this.image.onplay = async ()=>{
|
|
1584
1596
|
this.live = true;
|
|
1585
1597
|
try {
|
|
1586
|
-
$cb913ea078a876a6$var$selfieSegmentation
|
|
1598
|
+
$cb913ea078a876a6$var$selfieSegmentation?.onResults((res)=>{
|
|
1587
1599
|
this.onFrame(res);
|
|
1588
1600
|
});
|
|
1589
1601
|
this.timerWorker.onmessage = ()=>{
|
|
1590
|
-
$cb913ea078a876a6$var$selfieSegmentation
|
|
1602
|
+
$cb913ea078a876a6$var$selfieSegmentation?.send({
|
|
1591
1603
|
image: this.image
|
|
1592
1604
|
});
|
|
1593
1605
|
};
|
|
@@ -5298,7 +5310,7 @@ const $ae5056a5aa2b681d$export$3e37751cffc31fd8 = [
|
|
|
5298
5310
|
|
|
5299
5311
|
|
|
5300
5312
|
|
|
5301
|
-
const $800462b6cb0a3b0c$var$mixpanelToken =
|
|
5313
|
+
const $800462b6cb0a3b0c$var$mixpanelToken = undefined;
|
|
5302
5314
|
const $800462b6cb0a3b0c$export$18c6473b5b45bda1 = $800462b6cb0a3b0c$var$mixpanelToken ? (0, ($parcel$interopDefault($jQDcL$mixpanelbrowsersrcloadersloadermodulecore))).init($800462b6cb0a3b0c$var$mixpanelToken, {
|
|
5303
5315
|
track_pageview: false,
|
|
5304
5316
|
autocapture: false
|
|
@@ -10068,12 +10080,12 @@ const $d0ded347a490aa03$export$aab864ee9e2aed8d = ()=>{
|
|
|
10068
10080
|
},
|
|
10069
10081
|
children: /*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $jQDcL$snapcalldesignsystem.TabsList), {
|
|
10070
10082
|
className: (0, ($parcel$interopDefault($jQDcL$classnames)))('flex w-full border border-black/10 rounded-2xl backdrop-blur-[20px]', hasVideo ? 'bg-gray-25/50' : 'bg-gray-50'),
|
|
10071
|
-
children: availableModes.map((
|
|
10083
|
+
children: availableModes.map((availableMode)=>/*#__PURE__*/ (0, $jQDcL$reactjsxruntime.jsx)((0, $jQDcL$snapcalldesignsystem.TabsTrigger), {
|
|
10072
10084
|
className: (0, ($parcel$interopDefault($jQDcL$classnames)))('flex-1 rounded-xl text-black dark:data-[state=active]:text-white data-[state=active]:bg-black', hasVideo ? 'hover:bg-black/5' : 'hover:bg-gray-200'),
|
|
10073
|
-
value:
|
|
10074
|
-
disabled: devicesState.data?.isAskingPermissions,
|
|
10075
|
-
children:
|
|
10076
|
-
},
|
|
10085
|
+
value: availableMode.value,
|
|
10086
|
+
disabled: devicesState.data?.isAskingPermissions && !(mode === 'upload' || mode === 'screen'),
|
|
10087
|
+
children: availableMode.title
|
|
10088
|
+
}, availableMode.value))
|
|
10077
10089
|
})
|
|
10078
10090
|
})
|
|
10079
10091
|
});
|
|
@@ -11235,6 +11247,7 @@ const $07ad611f1c0acb4b$export$60c4050edc47776a = ({ streamToken: streamToken, o
|
|
|
11235
11247
|
},
|
|
11236
11248
|
onMessage: (message, payload)=>{
|
|
11237
11249
|
if (message === 'idCheck.onApplicantVerificationCompleted' && // @ts-expect-error invalid lib types
|
|
11250
|
+
payload.reviewResult.reviewAnswer === 'GREEN' || message === 'idCheck.onApplicantStatusChanged' && // @ts-expect-error invalid lib types
|
|
11238
11251
|
payload.reviewResult.reviewAnswer === 'GREEN') setTimeout(()=>{
|
|
11239
11252
|
onSuccess?.();
|
|
11240
11253
|
}, 1500);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snapcall/stream-ui",
|
|
3
|
-
"version": "1.41.1",
|
|
3
|
+
"version": "1.41.3-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"main": "dist/stream-ui.js",
|
|
@@ -94,7 +94,6 @@
|
|
|
94
94
|
"typescript": "^5.8.3"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@mediapipe/selfie_segmentation": "^0.1.1675465747",
|
|
98
97
|
"@snapcall/design-system": "^1.23.3",
|
|
99
98
|
"@sumsub/websdk-react": "^2.5.0",
|
|
100
99
|
"@tanstack/react-query": "^5.81.5",
|