@tsocial/tvweb-sdk.tcb 5.4.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/README.md +3 -0
- package/assets/frontal.svg +17 -0
- package/assets/ic_camera.svg +28 -0
- package/assets/ic_close.png +0 -0
- package/assets/ic_close_black.png +0 -0
- package/assets/ic_face_frontal.svg +8 -0
- package/assets/ic_loading.png +0 -0
- package/assets/id_card_frame.png +0 -0
- package/build/tvweb-sdk.cjs.min.js +75 -0
- package/examples/extract-id-info-and-liveness-detection/index.html +438 -0
- package/examples/extract-id-info-and-liveness-detection/style.css +58 -0
- package/examples/index.html +20 -0
- package/package.json +38 -0
@@ -0,0 +1,438 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
6
|
+
<meta name="description" content="Vanilla JS demo" />
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
9
|
+
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
10
|
+
|
11
|
+
<link rel="stylesheet" href="./style.css" />
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
15
|
+
<h2>Extract ID Info & Liveness detection</h2>
|
16
|
+
<div id="container"></div>
|
17
|
+
|
18
|
+
<div style="margin-bottom: 10px">
|
19
|
+
<label>
|
20
|
+
Keys:
|
21
|
+
<select id="select-api-key" onchange="onSelectKey()">
|
22
|
+
<option value="0" selected>Web face tracking (..a31)</option>
|
23
|
+
<option value="1">QA (..217)</option>
|
24
|
+
<option value="2">Labeller test real data (..3b2)</option>
|
25
|
+
<option value="3">Labeller test fake data (..ac4)</option>
|
26
|
+
</select>
|
27
|
+
</label>
|
28
|
+
</div>
|
29
|
+
<div style="margin-bottom: 10px">
|
30
|
+
<label>
|
31
|
+
Access key
|
32
|
+
<input id="access-key" style="width: 500px" />
|
33
|
+
</label>
|
34
|
+
</div>
|
35
|
+
<div style="margin-bottom: 10px">
|
36
|
+
<label>
|
37
|
+
Secret key
|
38
|
+
<input id="secret-key" style="width: 500px" />
|
39
|
+
</label>
|
40
|
+
</div>
|
41
|
+
<div style="margin-bottom: 10px">
|
42
|
+
<label>
|
43
|
+
API URL
|
44
|
+
<input id="api-url" style="width: 500px" />
|
45
|
+
</label>
|
46
|
+
</div>
|
47
|
+
<div>
|
48
|
+
Api check
|
49
|
+
<select id="select-api-check">
|
50
|
+
<option value="false">false</option>
|
51
|
+
<option value="true" selected>true</option>
|
52
|
+
</select>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div style="margin-top: 10px;">
|
56
|
+
<label>
|
57
|
+
Cached User ID
|
58
|
+
<input id="user-id" readonly style="width: 300px" />
|
59
|
+
</label>
|
60
|
+
<button onclick="clearUserId()">Clear user id (x-request-id)</button>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div style="display: inline-block; margin-top: 10px;">
|
64
|
+
<div>
|
65
|
+
Tracking config
|
66
|
+
<select id="select-tracking-config-template" onchange="onSelectTrackingConfigTemplate()">
|
67
|
+
<option value="0" selected>default</option>
|
68
|
+
<option value="1">Engineering test (...9fe5)</option>
|
69
|
+
</select>
|
70
|
+
</div>
|
71
|
+
<textarea cols="55" rows="8" id="tracking-config"></textarea>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
<div style="margin-top: 10px;">
|
75
|
+
<div>
|
76
|
+
Encryption config
|
77
|
+
</div>
|
78
|
+
<textarea cols="55" rows="4" id="encryption-config"></textarea>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<hr />
|
82
|
+
<h4>Extract ID Info</h4>
|
83
|
+
<div style="display: inline-block; margin-right: 20px;">
|
84
|
+
<div>Settings (notice that if <strong>Api check: true</strong>, settings from api will overwrite these settings)</div>
|
85
|
+
<textarea cols="55" rows="15" id="id-card-settings"></textarea>
|
86
|
+
</div>
|
87
|
+
<div style="display: inline-block">
|
88
|
+
<div>Steps</div>
|
89
|
+
<textarea cols="55" rows="15" id="id-card-steps"></textarea>
|
90
|
+
</div>
|
91
|
+
<div style="margin-bottom: 10px">
|
92
|
+
<button onclick="runWarmUpReadIDCard()">Warm up</button>
|
93
|
+
<span id="status-warmup-read-id-card"></span>
|
94
|
+
</div>
|
95
|
+
<button onclick="startExtractIDInfo()">Start</button>
|
96
|
+
<pre id="result-extract-id-info"></pre>
|
97
|
+
<div id="read-id-card-loading" style="margin-top: 10px; display: none;">
|
98
|
+
Api checking
|
99
|
+
<div class="dot-windmill"></div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<hr />
|
103
|
+
|
104
|
+
<h4>Liveness detection</h4>
|
105
|
+
<div>
|
106
|
+
Mode:
|
107
|
+
<select id="select-mode"></select>
|
108
|
+
</div>
|
109
|
+
<div>
|
110
|
+
Camera:
|
111
|
+
<select id="select-camera">
|
112
|
+
<option value="true">Front</option>
|
113
|
+
<option value="false">Back</option>
|
114
|
+
</select>
|
115
|
+
</div>
|
116
|
+
<div>
|
117
|
+
<div>Custom step time constraints (ms):</div>
|
118
|
+
<textarea cols="25" rows="15" id="custom-step-time-constraints"></textarea>
|
119
|
+
</div>
|
120
|
+
<button onclick="startLivenessDetection()" id="btn-start-liveness">
|
121
|
+
Liveness detection
|
122
|
+
</button>
|
123
|
+
<div id="liveness-loading" style="padding-top: 10px; display: none;">
|
124
|
+
Api checking
|
125
|
+
<div class="dot-windmill"></div>
|
126
|
+
</div>
|
127
|
+
<div id="result-liveness-detection"></div>
|
128
|
+
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
|
129
|
+
<script src="https://unpkg.com/@tsocial/trustvision-sdk@2.10.1/dist/trustvision-sdk.umd.js"></script>
|
130
|
+
<script src="../../build/tvweb-sdk.tcb.standalone.min.js"></script>
|
131
|
+
<script>
|
132
|
+
const keys = [
|
133
|
+
{
|
134
|
+
accessKey: "f051dfd3-8a6e-4a15-a4e8-7ea8cdc84a31",
|
135
|
+
secretKey: "vgiKCenoKvhPq79KABbFmxCBu6WX1tdw",
|
136
|
+
},
|
137
|
+
{
|
138
|
+
accessKey: "b96f7a1a-a7f1-46e8-9d7f-5f43d2d51217",
|
139
|
+
secretKey: "SYsUyQ792pLm7rnDRQFfIL6cgAecZCOp",
|
140
|
+
},
|
141
|
+
{
|
142
|
+
accessKey: "db3d055f-ba7b-4177-b7e8-110068bda3b2",
|
143
|
+
secretKey: "R1zjKNbTH3RkT2xgO2CarxAsFbcLCdsf",
|
144
|
+
},
|
145
|
+
{
|
146
|
+
accessKey: "4e24c8f3-7fe0-4824-9339-9a1216a72ac4",
|
147
|
+
secretKey: "CkoyKslrfBGv4m53LIlH0Q8yJYf4O56e",
|
148
|
+
},
|
149
|
+
];
|
150
|
+
function onSelectKey() {
|
151
|
+
const selectedKey = document.getElementById("select-api-key").value;
|
152
|
+
const { accessKey, secretKey } = keys[selectedKey];
|
153
|
+
inputAccessKey.value = accessKey;
|
154
|
+
inputSecretKey.value = secretKey;
|
155
|
+
}
|
156
|
+
</script>
|
157
|
+
<script type="text/javascript">
|
158
|
+
const tv = new TVWebSDK.SDK({
|
159
|
+
container: document.getElementById("container"),
|
160
|
+
lang: "vi",
|
161
|
+
assetRoot: "https://unpkg.com/@tsocial/tvweb-sdk.tcb@latest/assets",
|
162
|
+
enableAntiDebug: false,
|
163
|
+
});
|
164
|
+
window.tv = tv;
|
165
|
+
const resultExtractIdInfoEl = document.getElementById(
|
166
|
+
"result-extract-id-info"
|
167
|
+
);
|
168
|
+
const resultLivenessDetectionEl = document.getElementById(
|
169
|
+
"result-liveness-detection"
|
170
|
+
);
|
171
|
+
const selectModeEl = document.getElementById("select-mode");
|
172
|
+
const selectApiCheckEl = document.getElementById("select-api-check");
|
173
|
+
const inputAccessKey = document.getElementById("access-key");
|
174
|
+
const inputSecretKey = document.getElementById("secret-key");
|
175
|
+
const inputApiUrl = document.getElementById("api-url");
|
176
|
+
const userIdEl = document.getElementById("user-id");
|
177
|
+
const trackingConfigEl = document.getElementById("tracking-config");
|
178
|
+
const encryptionConfigEl = document.getElementById("encryption-config");
|
179
|
+
const readIdCardLoadingEl = document.getElementById("read-id-card-loading");
|
180
|
+
const customStepTimeConstraintsEl = document.getElementById("custom-step-time-constraints");
|
181
|
+
const statusWarmupReadIDCardEl = document.getElementById("status-warmup-read-id-card");
|
182
|
+
const livenessLoadingEl = document.getElementById("liveness-loading");
|
183
|
+
const startLivenessBtn = document.getElementById("btn-start-liveness");
|
184
|
+
const idCardSettingsEl = document.getElementById("id-card-settings");
|
185
|
+
const idCardStepsEl = document.getElementById("id-card-steps");
|
186
|
+
inputAccessKey.value = "f051dfd3-8a6e-4a15-a4e8-7ea8cdc84a31";
|
187
|
+
inputSecretKey.value = "vgiKCenoKvhPq79KABbFmxCBu6WX1tdw";
|
188
|
+
inputApiUrl.value = "https://tv-testing.trustingsocial.com/api";
|
189
|
+
userIdEl.value = JSON.parse(localStorage.getItem("user-id"));
|
190
|
+
|
191
|
+
const trackingConfigTemplates = [
|
192
|
+
TVWebSDK.TrackingContext.defaultTrackingConfig,
|
193
|
+
{
|
194
|
+
"enable": true,
|
195
|
+
"accessKey": "4df5f9b9-f34d-4ffa-829f-aa4889bc9fe5",
|
196
|
+
"secretKey": "dQDfxkVYXfAxpdReqdOd1zJP4pJ088Y7",
|
197
|
+
"apiUrl": "https://tv-testing.trustingsocial.com/api",
|
198
|
+
"userId": ""
|
199
|
+
},
|
200
|
+
];
|
201
|
+
function onSelectTrackingConfigTemplate() {
|
202
|
+
const selected = document.getElementById("select-tracking-config-template").value;
|
203
|
+
trackingConfigEl.value = JSON.stringify(trackingConfigTemplates[selected], null, 2);
|
204
|
+
}
|
205
|
+
|
206
|
+
Object.keys(TVWebSDK.Constants.Mode).forEach((k) => {
|
207
|
+
const option = document.createElement("option");
|
208
|
+
option.appendChild(document.createTextNode(k));
|
209
|
+
option.setAttribute("value", TVWebSDK.Constants.Mode[k]);
|
210
|
+
selectModeEl.appendChild(option);
|
211
|
+
});
|
212
|
+
|
213
|
+
const customStepTimeConstraintsData = {
|
214
|
+
[TVWebSDK.Constants.FaceDirection.UP]: { delayTime: 1000 },
|
215
|
+
[TVWebSDK.Constants.FaceDirection.LEFT]: { delayTime: 1000 },
|
216
|
+
[TVWebSDK.Constants.FaceDirection.RIGHT]: { delayTime: 1000 },
|
217
|
+
[TVWebSDK.Constants.FaceDirection.FRONTAL]: { delayTime: 2000 },
|
218
|
+
};
|
219
|
+
|
220
|
+
customStepTimeConstraintsEl.value = JSON.stringify(customStepTimeConstraintsData, null, 2);
|
221
|
+
idCardSettingsEl.value = JSON.stringify(TVWebSDK.defaultClientSettings, null, 2);
|
222
|
+
idCardStepsEl.value = JSON.stringify(TVWebSDK.defaultReadIDCardSteps, null, 2);
|
223
|
+
trackingConfigEl.value = JSON.stringify(TVWebSDK.TrackingContext.defaultTrackingConfig, null, 2);
|
224
|
+
encryptionConfigEl.value = JSON.stringify({ key: '' }, null, 2);
|
225
|
+
|
226
|
+
function clearUserId() {
|
227
|
+
window.localStorage.removeItem('user-id');
|
228
|
+
userIdEl.value = JSON.parse(localStorage.getItem("user-id"));
|
229
|
+
}
|
230
|
+
|
231
|
+
function runWarmUpReadIDCard() {
|
232
|
+
statusWarmupReadIDCardEl.innerHTML = "..."
|
233
|
+
tv.runWarmUpReadIDCard().then(function() {
|
234
|
+
statusWarmupReadIDCardEl.innerHTML = "...done"
|
235
|
+
})
|
236
|
+
}
|
237
|
+
|
238
|
+
function handleStepDoneIDCard ({ stepNumber, image, qrScannedResult, recordedVideos, apiResult }) {
|
239
|
+
const steps = JSON.parse(idCardStepsEl.value)
|
240
|
+
|
241
|
+
resultExtractIdInfoEl.appendChild(document.createTextNode(`\n-----------------------------------------\n`))
|
242
|
+
resultExtractIdInfoEl.appendChild(document.createTextNode(`\nSTEP NUMBER ${stepNumber}:\n`));
|
243
|
+
const imgEl = document.createElement("img");
|
244
|
+
imgEl.width = "300";
|
245
|
+
imgEl.src = URL.createObjectURL(image.blob);
|
246
|
+
resultExtractIdInfoEl.appendChild(imgEl);
|
247
|
+
resultExtractIdInfoEl.appendChild(document.createElement("br"));
|
248
|
+
resultExtractIdInfoEl.appendChild(document.createTextNode(`Recorded videos: ${recordedVideos.length}\n`));
|
249
|
+
|
250
|
+
if (qrScannedResult) {
|
251
|
+
const { result, image } = qrScannedResult
|
252
|
+
|
253
|
+
const qrImgEl = document.createElement("img");
|
254
|
+
qrImgEl.width = "200";
|
255
|
+
qrImgEl.src = URL.createObjectURL(image.blob);
|
256
|
+
resultExtractIdInfoEl.appendChild(qrImgEl);
|
257
|
+
resultExtractIdInfoEl.appendChild(document.createTextNode(`\n${result}\n`));
|
258
|
+
}
|
259
|
+
|
260
|
+
if (apiResult) {
|
261
|
+
resultExtractIdInfoEl.appendChild(document.createTextNode("API Result:\n"));
|
262
|
+
const apiResultEl = document.createElement('textarea');
|
263
|
+
apiResultEl.value = JSON.stringify(apiResult, null, 2);
|
264
|
+
apiResultEl.cols = 55
|
265
|
+
apiResultEl.rows = 15
|
266
|
+
resultExtractIdInfoEl.appendChild(apiResultEl);
|
267
|
+
}
|
268
|
+
|
269
|
+
// all steps done
|
270
|
+
if (stepNumber === steps.length - 1) {
|
271
|
+
tv.destroyView();
|
272
|
+
readIdCardLoadingEl.style.display = 'none';
|
273
|
+
}
|
274
|
+
}
|
275
|
+
|
276
|
+
async function handleDetectIdCard (props) {
|
277
|
+
const { cardType, image, cardSide } = props
|
278
|
+
const apiClient = new trustvisionSdk.default(inputAccessKey.value, inputSecretKey.value, inputApiUrl.value);
|
279
|
+
const resultUpload = await apiClient.uploadImage({
|
280
|
+
file: image.blob,
|
281
|
+
label: `id_card.${cardType}.${cardSide}`,
|
282
|
+
});
|
283
|
+
const imageId = resultUpload.data.image_id
|
284
|
+
const resultDetect = await apiClient.httpClient.post('/v1/detect_id_cards_sync', {
|
285
|
+
card_type: cardType,
|
286
|
+
image: {
|
287
|
+
id: imageId,
|
288
|
+
}
|
289
|
+
});
|
290
|
+
return _.get(resultDetect, 'data.image.cards.0')
|
291
|
+
}
|
292
|
+
|
293
|
+
function startExtractIDInfo() {
|
294
|
+
const apiCheck = selectApiCheckEl.value === "true";
|
295
|
+
resultExtractIdInfoEl.innerHTML = "";
|
296
|
+
|
297
|
+
const commonProps = {
|
298
|
+
onError: (e) => {
|
299
|
+
resultExtractIdInfoEl.appendChild(
|
300
|
+
document.createTextNode(`Error:\n${JSON.stringify(e, null, 2)}`)
|
301
|
+
);
|
302
|
+
tv.destroyView();
|
303
|
+
readIdCardLoadingEl.style.display = 'none';
|
304
|
+
},
|
305
|
+
clientSettings: JSON.parse(idCardSettingsEl.value),
|
306
|
+
detectIdCard: handleDetectIdCard,
|
307
|
+
onStepDone: handleStepDoneIDCard,
|
308
|
+
steps: JSON.parse(idCardStepsEl.value),
|
309
|
+
tracking: JSON.parse(trackingConfigEl.value),
|
310
|
+
outputEncryptionSettings: JSON.parse(encryptionConfigEl.value),
|
311
|
+
}
|
312
|
+
|
313
|
+
if (apiCheck) {
|
314
|
+
console.log('With api call')
|
315
|
+
tv.readIDCardWithApiCall({
|
316
|
+
apiCredentials: {
|
317
|
+
accessKey: inputAccessKey.value,
|
318
|
+
secretKey: inputSecretKey.value,
|
319
|
+
apiUrl: inputApiUrl.value,
|
320
|
+
},
|
321
|
+
...commonProps,
|
322
|
+
})
|
323
|
+
} else {
|
324
|
+
console.log('UI only')
|
325
|
+
tv.readIDCardUIOnly(commonProps)
|
326
|
+
}
|
327
|
+
}
|
328
|
+
|
329
|
+
function startLivenessDetection() {
|
330
|
+
const livenessDetectionMode = selectModeEl.value;
|
331
|
+
const apiCheck = selectApiCheckEl.value === "true";
|
332
|
+
const cameraSelected = document.getElementById("select-camera");
|
333
|
+
|
334
|
+
tv.livenessDetection({
|
335
|
+
apiCheck: apiCheck,
|
336
|
+
mode: livenessDetectionMode,
|
337
|
+
accessKey: inputAccessKey.value,
|
338
|
+
secretKey: inputSecretKey.value,
|
339
|
+
apiUrl: inputApiUrl.value,
|
340
|
+
onLivenessDetectionDone: handleLivenessDetectionDone,
|
341
|
+
customStepTimeConstraints: JSON.parse(customStepTimeConstraintsEl.value),
|
342
|
+
captureFrameSettings: {
|
343
|
+
enable: true,
|
344
|
+
framesIntervalTime: 180,
|
345
|
+
framesBatchLength: 0,
|
346
|
+
},
|
347
|
+
onError: (e) => {
|
348
|
+
livenessLoadingEl.style.display = "none";
|
349
|
+
startLivenessBtn.disabled = false;
|
350
|
+
resultLivenessDetectionEl.appendChild(
|
351
|
+
document.createTextNode(`${JSON.stringify(e, null, 2)}`)
|
352
|
+
);
|
353
|
+
},
|
354
|
+
frontCamera: cameraSelected.value === "true",
|
355
|
+
onProcessing: () => {
|
356
|
+
livenessLoadingEl.style.display = "block";
|
357
|
+
startLivenessBtn.disabled = true;
|
358
|
+
|
359
|
+
resultLivenessDetectionEl.innerHTML = "";
|
360
|
+
|
361
|
+
setTimeout(() => {
|
362
|
+
tv.destroyView();
|
363
|
+
}, 250);
|
364
|
+
},
|
365
|
+
});
|
366
|
+
}
|
367
|
+
|
368
|
+
function handleReadIDCardResult({ image, recordedVideos, apiResult }) {
|
369
|
+
const apiCheck = selectApiCheckEl.value === "true";
|
370
|
+
|
371
|
+
const imgEl = document.createElement("img");
|
372
|
+
imgEl.width = "200";
|
373
|
+
imgEl.src = URL.createObjectURL(image);
|
374
|
+
resultExtractIdInfoEl.appendChild(imgEl);
|
375
|
+
resultExtractIdInfoEl.appendChild(document.createElement("br"));
|
376
|
+
resultExtractIdInfoEl.appendChild(document.createTextNode(`Recorded videos: ${recordedVideos.length}\n`));
|
377
|
+
|
378
|
+
if (apiCheck) {
|
379
|
+
resultExtractIdInfoEl.appendChild(document.createTextNode("API Result:\n"));
|
380
|
+
resultExtractIdInfoEl.appendChild(
|
381
|
+
document.createTextNode(`${JSON.stringify(apiResult, null, 2)}`)
|
382
|
+
);
|
383
|
+
if (cardSide === TVWebSDK.Constants.IDCardSide.FRONT) {
|
384
|
+
const frontCardId = apiResult.cardInfo.image1.id;
|
385
|
+
inputFrontIdEl.value = frontCardId;
|
386
|
+
}
|
387
|
+
}
|
388
|
+
|
389
|
+
tv.destroyView();
|
390
|
+
readIdCardLoadingEl.style.display = 'none';
|
391
|
+
}
|
392
|
+
|
393
|
+
function handleLivenessDetectionDone(result) {
|
394
|
+
const { frontalFaces, apiCheckPassed, steps } = result;
|
395
|
+
const apiCheck = selectApiCheckEl.value === "true";
|
396
|
+
resultLivenessDetectionEl.innerHTML = "";
|
397
|
+
|
398
|
+
if (apiCheck === false) {
|
399
|
+
livenessLoadingEl.style.display = "none";
|
400
|
+
startLivenessBtn.disabled = false;
|
401
|
+
resultLivenessDetectionEl.appendChild(
|
402
|
+
document.createTextNode("Random frontal faces detected: ")
|
403
|
+
);
|
404
|
+
frontalFaces.forEach((blob) => {
|
405
|
+
const imgEl = document.createElement("img");
|
406
|
+
imgEl.width = "200";
|
407
|
+
imgEl.style.marginRight = "5px";
|
408
|
+
imgEl.src = URL.createObjectURL(blob);
|
409
|
+
resultLivenessDetectionEl.appendChild(imgEl);
|
410
|
+
});
|
411
|
+
resultLivenessDetectionEl.appendChild(document.createElement("br"));
|
412
|
+
resultLivenessDetectionEl.appendChild(document.createElement("br"));
|
413
|
+
resultLivenessDetectionEl.appendChild(
|
414
|
+
document.createTextNode("Directional faces:")
|
415
|
+
);
|
416
|
+
steps.forEach((s) => {
|
417
|
+
const imgEl = document.createElement("img");
|
418
|
+
imgEl.width = "200";
|
419
|
+
imgEl.style.marginRight = "5px";
|
420
|
+
imgEl.src = URL.createObjectURL(s.image.blob);
|
421
|
+
resultLivenessDetectionEl.appendChild(imgEl);
|
422
|
+
});
|
423
|
+
resultLivenessDetectionEl.appendChild(document.createElement("br"));
|
424
|
+
resultLivenessDetectionEl.appendChild(document.createElement("br"));
|
425
|
+
resultLivenessDetectionEl.appendChild(
|
426
|
+
document.createTextNode("Video:")
|
427
|
+
);
|
428
|
+
} else {
|
429
|
+
livenessLoadingEl.style.display = "none";
|
430
|
+
startLivenessBtn.disabled = false;
|
431
|
+
resultLivenessDetectionEl.appendChild(
|
432
|
+
document.createTextNode(`apiCheckPassed: ${apiCheckPassed}`)
|
433
|
+
);
|
434
|
+
}
|
435
|
+
}
|
436
|
+
</script>
|
437
|
+
</body>
|
438
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
body {
|
2
|
+
font-family: 'Nunito', sans-serif;
|
3
|
+
}
|
4
|
+
|
5
|
+
.dot-windmill {
|
6
|
+
position: relative;
|
7
|
+
top: -10px;
|
8
|
+
width: 10px;
|
9
|
+
height: 10px;
|
10
|
+
border-radius: 5px;
|
11
|
+
background-color: #9880ff;
|
12
|
+
color: #9880ff;
|
13
|
+
transform-origin: 5px 15px;
|
14
|
+
animation: dotWindmill 2s infinite linear;
|
15
|
+
margin-left: 100px;
|
16
|
+
margin-top: -10px;
|
17
|
+
}
|
18
|
+
|
19
|
+
.dot-windmill::before,
|
20
|
+
.dot-windmill::after {
|
21
|
+
content: "";
|
22
|
+
display: inline-block;
|
23
|
+
position: absolute;
|
24
|
+
}
|
25
|
+
|
26
|
+
.dot-windmill::before {
|
27
|
+
left: -8.66px;
|
28
|
+
top: 15px;
|
29
|
+
width: 10px;
|
30
|
+
height: 10px;
|
31
|
+
border-radius: 5px;
|
32
|
+
background-color: #9880ff;
|
33
|
+
color: #9880ff;
|
34
|
+
}
|
35
|
+
|
36
|
+
.dot-windmill::after {
|
37
|
+
left: 8.66px;
|
38
|
+
top: 15px;
|
39
|
+
width: 10px;
|
40
|
+
height: 10px;
|
41
|
+
border-radius: 5px;
|
42
|
+
background-color: #9880ff;
|
43
|
+
color: #9880ff;
|
44
|
+
}
|
45
|
+
|
46
|
+
@keyframes dotWindmill {
|
47
|
+
0% {
|
48
|
+
transform: rotateZ(0deg) translate3d(0, 0, 0);
|
49
|
+
}
|
50
|
+
100% {
|
51
|
+
transform: rotateZ(720deg) translate3d(0, 0, 0);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
#btn-start-liveness {
|
56
|
+
margin-top: 20px;
|
57
|
+
}
|
58
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
6
|
+
<meta name="description" content="Vanilla JS demo" />
|
7
|
+
<title>TrustVision SDK Examples</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
11
|
+
<h2>TrustVision SDK Examples</h2>
|
12
|
+
<ul>
|
13
|
+
<li>
|
14
|
+
<a href="extract-id-info-and-liveness-detection/index.html"
|
15
|
+
>Extract ID info & Liveness detection</a
|
16
|
+
>
|
17
|
+
</li>
|
18
|
+
</ul>
|
19
|
+
</body>
|
20
|
+
</html>
|
package/package.json
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"name": "@tsocial/tvweb-sdk.tcb",
|
3
|
+
"version": "5.4.0",
|
4
|
+
"description": "TV Web SDK - The Standalone VIB SDK",
|
5
|
+
"keywords": [],
|
6
|
+
"license": "ISC",
|
7
|
+
"main": "build/tvweb-sdk.cjs.min.js",
|
8
|
+
"module": "build/tvweb-sdk.esm.min.js",
|
9
|
+
"src": "src/index.js",
|
10
|
+
"publishConfig": {
|
11
|
+
"access": "public"
|
12
|
+
},
|
13
|
+
"files": [
|
14
|
+
"build/tvweb-sdk.vib.standalone.min.js",
|
15
|
+
"examples",
|
16
|
+
"assets"
|
17
|
+
],
|
18
|
+
"scripts": {
|
19
|
+
"build": "yarn run tvweb-builder --type standalone --libName TVWebSDK",
|
20
|
+
"pack": "tvweb-builder --type standalone --libName TVWebSDK --defaultAssetRoot ./assets",
|
21
|
+
"run-example": "tvweb-builder --type standalone --libName TVWebSDK && http-server ./ -c-1",
|
22
|
+
"test": "echo \"Error: run tests from root\" && exit 1"
|
23
|
+
},
|
24
|
+
"dependencies": {
|
25
|
+
"@tsocial/trustvision-sdk": "2.10.1",
|
26
|
+
"@tsocial/tvweb-core": "^5.4.0",
|
27
|
+
"@tsocial/tvweb-ui": "^5.4.0",
|
28
|
+
"invariant": "^2.2.4",
|
29
|
+
"react": "^16.14.0",
|
30
|
+
"react-app-polyfill": "^2.0.0",
|
31
|
+
"react-dom": "^16.14.0",
|
32
|
+
"styled-components": "^5.2.1"
|
33
|
+
},
|
34
|
+
"devDependencies": {
|
35
|
+
"@tsocial/tvweb-builder": "^5.4.0"
|
36
|
+
},
|
37
|
+
"gitHead": "c2aedb28f04afe4cb63281fe17fff6baaceb560a"
|
38
|
+
}
|