@regulaforensics/vp-frontend-document-components 1.2.0 → 2.0.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 +660 -81
- package/dist/main.js +1 -1
- package/dist/main.js.LICENSE.txt +41 -0
- package/esm/main.js +2 -0
- package/esm/main.js.LICENSE.txt +41 -0
- package/lib/common/BackCameraIcon.d.ts +6 -0
- package/lib/common/Button.d.ts +7 -0
- package/lib/common/CameraChangeIcon.d.ts +6 -0
- package/lib/common/CameraIcon.d.ts +6 -0
- package/lib/common/CheckIcon.d.ts +6 -0
- package/lib/common/CrossIcon.d.ts +6 -0
- package/lib/common/DocReaderCameraDisabled.d.ts +5 -0
- package/lib/common/DocReaderCameraPreparing.d.ts +5 -0
- package/lib/common/DocReaderFlip.d.ts +5 -0
- package/lib/common/DocReaderProcessing.d.ts +5 -0
- package/lib/common/DocReaderProcessingError.d.ts +5 -0
- package/lib/common/DocReaderProcessingFinished.d.ts +6 -0
- package/lib/common/DocReaderSearch.d.ts +5 -0
- package/lib/common/ErrorIcon.d.ts +6 -0
- package/lib/common/FromCameraIcon.d.ts +5 -0
- package/lib/common/FromGalleryIcon.d.ts +5 -0
- package/lib/common/FrontCameraIcon.d.ts +6 -0
- package/lib/common/FullscreenExitIcon.d.ts +6 -0
- package/lib/common/FullscreenIcon.d.ts +6 -0
- package/lib/common/Icon.d.ts +7 -0
- package/lib/common/InstructionIconFaceDetection.d.ts +5 -0
- package/lib/common/InstructionIconFaceLiveness.d.ts +5 -0
- package/lib/common/Message.d.ts +7 -0
- package/lib/common/NoGlareIcon.d.ts +5 -0
- package/lib/common/NoSmilingIcon.d.ts +5 -0
- package/lib/common/RegulaLogo.d.ts +6 -0
- package/lib/common/SnapshotIcon.d.ts +6 -0
- package/lib/common/Spinner.d.ts +3 -0
- package/lib/common/SquareIcon.d.ts +6 -0
- package/lib/common/StopIcon.d.ts +6 -0
- package/lib/common/VerifiedIcon.d.ts +6 -0
- package/lib/components/CameraCapture.d.ts +9 -0
- package/lib/components/CameraSnapshot.d.ts +2 -0
- package/lib/components/CameraSnapshotFileCapture.d.ts +10 -0
- package/lib/components/DocumentCapture.d.ts +10 -0
- package/lib/components/DocumentFullScreenOverlay.d.ts +11 -0
- package/lib/components/DocumentReader.d.ts +2 -0
- package/lib/components/DocumentReaderFileCapture.d.ts +12 -0
- package/lib/components/DocumentReaderLayout.d.ts +22 -0
- package/lib/components/DocumentReaderStartScreen.d.ts +10 -0
- package/lib/components/ErrorBoundary.d.ts +18 -0
- package/lib/components/FaceCapture.d.ts +15 -0
- package/lib/components/FaceDetection.d.ts +2 -0
- package/lib/components/FaceFullScreenOverlay.d.ts +11 -0
- package/lib/components/FaceLayout.d.ts +18 -0
- package/lib/components/FaceLiveness.d.ts +2 -0
- package/lib/components/InfoScreen.d.ts +10 -0
- package/lib/components/InstructionScreen.d.ts +9 -0
- package/lib/components/ProcessScreen.d.ts +6 -0
- package/lib/components/RetryScreen.d.ts +7 -0
- package/lib/components/WebCamera.d.ts +19 -0
- package/lib/constants.d.ts +568 -0
- package/lib/contexts/DocumentAttributesContext.d.ts +24 -0
- package/lib/contexts/DocumentSDKContext.d.ts +6 -0
- package/lib/contexts/FaceAttributesContext.d.ts +21 -0
- package/lib/hoc/withDocumentAttributesContext.d.ts +4 -0
- package/lib/hoc/withDocumentSDKContext.d.ts +3 -0
- package/lib/hoc/withFaceAttributesContext.d.ts +4 -0
- package/lib/hoc/withLocalize.d.ts +7 -0
- package/lib/hooks/useDocumentReaderSeries.d.ts +25 -0
- package/lib/hooks/useDocumentReaderSingle.d.ts +15 -0
- package/lib/hooks/useFaceLiveness.d.ts +30 -0
- package/lib/hooks/useImageInputParam.d.ts +9 -0
- package/lib/hooks/useOrientationChange.d.ts +10 -0
- package/lib/hooks/useStream.d.ts +10 -0
- package/lib/hooks/useUserAgent.d.ts +3 -0
- package/lib/hooks/useWindowBlur.d.ts +2 -0
- package/lib/i18n/dictionaries/_dictionaries.d.ts +2115 -0
- package/lib/index-document.d.ts +5 -0
- package/lib/models/CameraModel.d.ts +9 -0
- package/lib/models/CustomError.d.ts +7 -0
- package/lib/models/ImageModel.d.ts +7 -0
- package/lib/services/DebugService.d.ts +13 -0
- package/lib/services/DocumentReaderProcessor.d.ts +53 -0
- package/lib/services/DocumentReaderService.d.ts +44 -0
- package/lib/services/EventEmitter.d.ts +9 -0
- package/lib/services/FaceLivenessService.d.ts +43 -0
- package/lib/services/FaceService.d.ts +12 -0
- package/lib/types.d.ts +323 -0
- package/lib/utils.d.ts +27 -0
- package/lib/web-components/CameraSnapshot.d.ts +11 -0
- package/lib/web-components/DocumentReader.d.ts +11 -0
- package/lib/web-components/FaceDetection.d.ts +11 -0
- package/lib/web-components/FaceLiveness.d.ts +14 -0
- package/lib/web-components/FullScreenContainer.d.ts +4 -0
- package/package.json +63 -69
package/README.md
CHANGED
|
@@ -1,160 +1,492 @@
|
|
|
1
1
|
# Table of contents
|
|
2
2
|
1. [About](#about)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
2. [Compatibility](#compatibility)
|
|
4
|
+
3. [UI components](#ui-components)
|
|
5
|
+
* [Integration via NPM](#integration-via-npm)
|
|
6
|
+
* [Integration via CDN](#integration-via-cdn)
|
|
7
|
+
* [Events](#events)
|
|
8
|
+
* [Response](#response)
|
|
9
|
+
* [Attributes](#attributes)
|
|
10
|
+
* [Customization](#customization)
|
|
11
|
+
4. [Document reader SDK](#document-reader-sdk)
|
|
12
|
+
* [SDK integration via NPM](#sdk-integration-via-npm)
|
|
13
|
+
* [SDK integration via CDN](#sdk-integration-via-cdn)
|
|
14
|
+
* [Available DocumentReaderProcessor methods](#available-documentreaderprocessor-methods)
|
|
15
|
+
* [DocumentReaderProcessor settings](#documentreaderprocessor-settings)
|
|
16
|
+
5. [Problems](#problems)
|
|
17
|
+
6. [Examples](#examples)
|
|
11
18
|
|
|
12
19
|
---
|
|
13
20
|
|
|
14
21
|
## About
|
|
15
22
|
|
|
16
|
-
This package contains web components for documents recognition.
|
|
23
|
+
This package contains UI web components and SDK for documents recognition.
|
|
17
24
|
|
|
18
25
|
## Compatibility
|
|
19
26
|
|
|
20
|
-
| Devices | ** |
|
|
23
|
-
| **Mobile (Android)** |
|
|
24
|
-
| **Desktop** |
|
|
27
|
+
| Devices |  |  |  |
|
|
28
|
+
|:---------------------|:-------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------:|
|
|
29
|
+
| **Mobile (iOS)** | 99 | 99 | 11 |
|
|
30
|
+
| **Mobile (Android)** | 66 | 61 | - |
|
|
31
|
+
| **Desktop** | 61 | 60 | 11 |
|
|
25
32
|
|
|
26
|
-
##
|
|
33
|
+
## UI components
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
### Integration via NPM
|
|
36
|
+
|
|
37
|
+
Install ```@regulaforensics/vp-frontend-document-components```:
|
|
29
38
|
|
|
30
39
|
```
|
|
31
|
-
|
|
40
|
+
npm i @regulaforensics/vp-frontend-document-components
|
|
32
41
|
```
|
|
33
42
|
|
|
34
|
-
|
|
43
|
+
Import ```defineComponents``` and ```DocumentReaderService``` from ```@regulaforensics/vp-frontend-document-components``` into your ```.js``` file:
|
|
35
44
|
|
|
45
|
+
```javascript
|
|
46
|
+
// If you use module bundler
|
|
47
|
+
import { defineComponents, DocumentReaderService } from '@regulaforensics/vp-frontend-document-components';
|
|
48
|
+
|
|
49
|
+
// If you don't use module bundler
|
|
50
|
+
import { defineComponents, DocumentReaderService } from './node_modules/@regulaforensics/vp-frontend-document-components/esm/main.js';
|
|
36
51
|
```
|
|
37
|
-
npm init
|
|
38
|
-
```
|
|
39
|
-
Answer the questions in the command line questionnaire.
|
|
40
52
|
|
|
41
|
-
|
|
53
|
+
Add ```DocumentReaderService``` to the global variable ```RegulaDocumentSDK```, define the components and prepare the service:
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
window.RegulaDocumentSDK = new DocumentReaderService();
|
|
57
|
+
|
|
58
|
+
defineComponents().then(async () => {
|
|
59
|
+
await window.RegulaDocumentSDK.prepare();
|
|
60
|
+
});
|
|
42
61
|
|
|
62
|
+
// Notice: If you use only the camera-snapshot component, then it is not necessary to create a global variable and prepare the service, use only defineComponents();
|
|
43
63
|
```
|
|
44
|
-
|
|
64
|
+
|
|
65
|
+
Add the component name to the ```.html``` file. The available components are:
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<document-reader></document-reader> <!-- for documents recognition -->
|
|
69
|
+
<camera-snapshot></camera-snapshot> <!-- to capture images from the camera and gallery -->
|
|
45
70
|
```
|
|
46
71
|
|
|
47
|
-
|
|
72
|
+
Notice: To use ```<document-reader></document-reader>``` component on test environments, set the base64 license value to the ```license``` attribute. Example: ```<document-reader license="BASE64_LICENSE_KEY"></document-reader>```.
|
|
48
73
|
|
|
49
|
-
|
|
74
|
+
### Integration via CDN
|
|
50
75
|
|
|
51
|
-
```
|
|
52
|
-
|
|
76
|
+
Connect the script in your ```.html``` file. CDN link: ```unpkg.com/:package@:version/:file```
|
|
77
|
+
|
|
78
|
+
For example:
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<!-- Replace <VERSION> with the package version. The list of versions is available on NPM in the versions section -->
|
|
82
|
+
<script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@<VERSION>/dist/main.js"></script>
|
|
53
83
|
```
|
|
54
84
|
|
|
55
|
-
In
|
|
85
|
+
In your ```.js``` file define the components and prepare the service. ```DocumentReaderService``` and ```defineComponents``` are available in the global variable ```window.Regula```:
|
|
56
86
|
|
|
57
|
-
|
|
58
|
-
|
|
87
|
+
```javascript
|
|
88
|
+
const { defineComponents, DocumentReaderService } = window.Regula;
|
|
59
89
|
|
|
60
|
-
|
|
90
|
+
window.RegulaDocumentSDK = new DocumentReaderService();
|
|
91
|
+
|
|
92
|
+
defineComponents().then(async () => {
|
|
93
|
+
await window.RegulaDocumentSDK.prepare();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Notice: If you use only the camera-snapshot component, then it is not necessary to create a global variable and prepare the service, use only defineComponents();
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Add the component name to the ```.html``` file. The available components are:
|
|
61
100
|
|
|
62
101
|
```html
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
<head>
|
|
66
|
-
<meta charset="utf-8" />
|
|
67
|
-
<title>My app</title>
|
|
68
|
-
</head>
|
|
69
|
-
<body>
|
|
70
|
-
<camera-snapshot></camera-snapshot>
|
|
71
|
-
<script type="module" src="index.js"></script>
|
|
72
|
-
</body>
|
|
73
|
-
</html>
|
|
102
|
+
<document-reader></document-reader> <!-- for documents recognition -->
|
|
103
|
+
<camera-snapshot></camera-snapshot> <!-- to capture images from the camera and gallery -->
|
|
74
104
|
```
|
|
75
105
|
|
|
76
|
-
|
|
106
|
+
Notice: To use ```<document-reader></document-reader>``` component on test environments, set the base64 license value to the ```license``` attribute. Example: ```<document-reader license="BASE64_LICENSE_KEY"></document-reader>```.
|
|
77
107
|
|
|
78
|
-
|
|
108
|
+
### Events
|
|
109
|
+
|
|
110
|
+
You can subscribe to the component events.
|
|
79
111
|
|
|
80
112
|
For example:
|
|
81
113
|
|
|
114
|
+
```javascript
|
|
115
|
+
const documentReaderComponent = document.querySelector('document-reader');
|
|
116
|
+
const cameraSnapshotComponent = document.querySelector('camera-snapshot');
|
|
117
|
+
|
|
118
|
+
documentReaderComponent.addEventListener('document-reader', (event) => console.log(event.detail)); // Event listener for document-reader component.
|
|
119
|
+
cameraSnapshotComponent.addEventListener('camera-snapshot', (event) => console.log(event.detail)); // Event listener for camera-snapshot component.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The ```document-reader``` type of event is generated for the document-reader component, and ```camera-snapshot``` type of event is generated for the camera-snapshot component.
|
|
123
|
+
|
|
124
|
+
The generated event object (```event.detail```) contains three fields that describe the event:
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
{
|
|
128
|
+
action: "PRESS_CAMERA_BUTTON", // the type of action that generated the event (all actions are described in the table below)
|
|
129
|
+
data: null, // component data
|
|
130
|
+
manual: true // event generated by user action or component by itself
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Type of actions:
|
|
135
|
+
|
|
136
|
+
| Type of action | Description of the action | In which component is present |
|
|
137
|
+
|:--------------------------|:-------------------------------------:|:--------------------------------------------:|
|
|
138
|
+
| ```ELEMENT_VISIBLE``` | Component is appended in the DOM. | ```document-reader```, ```camera-snapshot``` |
|
|
139
|
+
| ```PRESS_CAMERA_BUTTON``` | The "From camera" button is pressed. | ```document-reader```, ```camera-snapshot``` |
|
|
140
|
+
| ```PRESS_FILE_BUTTON``` | The "From gallery" button is pressed. | ```document-reader```, ```camera-snapshot``` |
|
|
141
|
+
| ```PRESS_RETRY_BUTTON``` | The "Retry" button is pressed. | ```document-reader```, ```camera-snapshot``` |
|
|
142
|
+
| ```PRESS_SKIP_BUTTON``` | The "Skip" button is pressed. | ```document-reader``` |
|
|
143
|
+
| ```CLOSE``` | The "Close" button is pressed. | ```document-reader```, ```camera-snapshot``` |
|
|
144
|
+
| ```PROCESS_FINISHED``` | The component has finished its work. | ```document-reader```, ```camera-snapshot``` |
|
|
145
|
+
| ```SERVICE_INITIALIZED``` | The component has started its work. | ```document-reader``` |
|
|
146
|
+
|
|
147
|
+
In cases of successful operation of the components, the ```data``` field will contain the following fields:
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
{
|
|
151
|
+
response: { ... }, // component result
|
|
152
|
+
status: 1 // 1 for successful work and 0 for unsuccessful
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
In cases of unsuccessful work, the ```data``` field will contain the following fields:
|
|
157
|
+
|
|
158
|
+
```javascript
|
|
159
|
+
{
|
|
160
|
+
reason: "CAMERA_PERMISSION_DENIED", // error reason (possible causes of errors are described in the table below)
|
|
161
|
+
status: 0
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Table of error causes:
|
|
166
|
+
|
|
167
|
+
| Reason | Description of the reason |
|
|
168
|
+
|:-------------------------------|:-----------------------------------:|
|
|
169
|
+
| ```WASM_ERROR``` | Error in WASM. |
|
|
170
|
+
| ```WASM_LICENSE``` | Missing or incorrect license. |
|
|
171
|
+
| ```FILE_SIZE``` | The file size is too large. |
|
|
172
|
+
| ```INCORRECT_FILE``` | Problems with reading the file. |
|
|
173
|
+
| ```UNKNOWN_ERROR``` | Unknown error. |
|
|
174
|
+
| ```NOT_SUPPORTED``` | The browser is not supported. |
|
|
175
|
+
| ```CAMERA_UNKNOWN_ERROR``` | Unknown camera error. |
|
|
176
|
+
| ```CAMERA_PERMISSION_DENIED``` | Access to the camera is prohibited. |
|
|
177
|
+
| ```NO_CAMERA``` | There is no camera. |
|
|
178
|
+
| ```CONNECTION_ERROR``` | Connection errors. |
|
|
179
|
+
|
|
180
|
+
The table below describes the cases of event generation:
|
|
181
|
+
|
|
182
|
+
<table>
|
|
183
|
+
<thead>
|
|
184
|
+
<tr>
|
|
185
|
+
<th>Event condition </th>
|
|
186
|
+
<th>Event type</th>
|
|
187
|
+
<th>
|
|
188
|
+
|
|
189
|
+
Event object ```event.detail```
|
|
190
|
+
</th>
|
|
191
|
+
<th>Description</th>
|
|
192
|
+
</tr>
|
|
193
|
+
</thead>
|
|
194
|
+
<tbody>
|
|
195
|
+
<tr>
|
|
196
|
+
<td>The component is mounted in the DOM.</td>
|
|
197
|
+
<td>
|
|
198
|
+
|
|
199
|
+
For document-reader:
|
|
200
|
+
```document-reader```
|
|
201
|
+
|
|
202
|
+
For camera-snapshot:
|
|
203
|
+
```camera-snapshot```
|
|
204
|
+
|
|
205
|
+
</td>
|
|
206
|
+
<td>
|
|
207
|
+
|
|
208
|
+
```javascript
|
|
209
|
+
{
|
|
210
|
+
action: "ELEMENT_VISIBLE",
|
|
211
|
+
data: null,
|
|
212
|
+
manual: true
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
</td>
|
|
217
|
+
<td>
|
|
218
|
+
|
|
219
|
+
To receive this event, you must wrap the component in another element (for example, a div) and add an addEventListener to it. When the component appears in the DOM, the event will pop up.
|
|
220
|
+
|
|
221
|
+
Example:
|
|
82
222
|
```html
|
|
83
|
-
<
|
|
223
|
+
<div id="add-event-listener-to-this-element">
|
|
224
|
+
<document-reader></document-reader>
|
|
225
|
+
</div>
|
|
84
226
|
```
|
|
85
227
|
|
|
86
|
-
|
|
228
|
+
</td>
|
|
229
|
+
</tr>
|
|
230
|
+
<tr>
|
|
231
|
+
<td>The "From camera" button is pressed.</td>
|
|
232
|
+
<td>
|
|
87
233
|
|
|
88
|
-
|
|
234
|
+
For document-reader:
|
|
235
|
+
```document-reader```
|
|
89
236
|
|
|
90
|
-
|
|
237
|
+
For camera-snapshot:
|
|
238
|
+
```camera-snapshot```
|
|
91
239
|
|
|
92
|
-
|
|
93
|
-
|
|
240
|
+
</td>
|
|
241
|
+
<td>
|
|
94
242
|
|
|
95
|
-
|
|
243
|
+
```javascript
|
|
244
|
+
{
|
|
245
|
+
action: "PRESS_CAMERA_BUTTON",
|
|
246
|
+
data: null,
|
|
247
|
+
manual: true
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
</td>
|
|
252
|
+
<td></td>
|
|
253
|
+
</tr>
|
|
254
|
+
<tr>
|
|
255
|
+
<td>The "From gallery" button is pressed.</td>
|
|
256
|
+
<td>
|
|
257
|
+
|
|
258
|
+
For document-reader:
|
|
259
|
+
```document-reader```
|
|
260
|
+
|
|
261
|
+
For camera-snapshot:
|
|
262
|
+
```camera-snapshot```
|
|
263
|
+
|
|
264
|
+
</td>
|
|
265
|
+
<td>
|
|
266
|
+
|
|
267
|
+
```javascript
|
|
268
|
+
{
|
|
269
|
+
action: "PRESS_FILE_BUTTON",
|
|
270
|
+
data: null,
|
|
271
|
+
manual: true
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
</td>
|
|
276
|
+
<td></td>
|
|
277
|
+
</tr>
|
|
278
|
+
<tr>
|
|
279
|
+
<td>The "Retry" button is pressed.</td>
|
|
280
|
+
<td>
|
|
281
|
+
|
|
282
|
+
For document-reader:
|
|
283
|
+
```document-reader```
|
|
284
|
+
|
|
285
|
+
For camera-snapshot:
|
|
286
|
+
```camera-snapshot```
|
|
287
|
+
|
|
288
|
+
</td>
|
|
289
|
+
<td>
|
|
290
|
+
|
|
291
|
+
```javascript
|
|
292
|
+
{
|
|
293
|
+
action: "PRESS_RETRY_BUTTON",
|
|
294
|
+
data: null,
|
|
295
|
+
manual: true
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
</td>
|
|
300
|
+
<td></td>
|
|
301
|
+
</tr>
|
|
302
|
+
<tr>
|
|
303
|
+
<td>The "Skip page" button is pressed.</td>
|
|
304
|
+
<td>
|
|
305
|
+
|
|
306
|
+
```document-reader```
|
|
307
|
+
|
|
308
|
+
</td>
|
|
309
|
+
<td>
|
|
310
|
+
|
|
311
|
+
```javascript
|
|
312
|
+
{
|
|
313
|
+
action: "PRESS_SKIP_BUTTON",
|
|
314
|
+
data: null,
|
|
315
|
+
manual: true
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
</td>
|
|
320
|
+
<td>
|
|
321
|
+
|
|
322
|
+
This event available only in ```document-reader```.
|
|
323
|
+
|
|
324
|
+
</td>
|
|
325
|
+
</tr>
|
|
326
|
+
<tr>
|
|
327
|
+
<td>The "Close" button is pressed.</td>
|
|
328
|
+
<td>
|
|
329
|
+
|
|
330
|
+
For document-reader:
|
|
331
|
+
```document-reader```
|
|
332
|
+
|
|
333
|
+
For camera-snapshot:
|
|
334
|
+
```camera-snapshot```
|
|
335
|
+
|
|
336
|
+
</td>
|
|
337
|
+
<td>
|
|
338
|
+
|
|
339
|
+
```javascript
|
|
340
|
+
{
|
|
341
|
+
action: "CLOSE",
|
|
342
|
+
data: null,
|
|
343
|
+
manual: true
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
</td>
|
|
348
|
+
<td></td>
|
|
349
|
+
</tr>
|
|
350
|
+
<tr>
|
|
351
|
+
<td>The work of the component is completed successfully.</td>
|
|
352
|
+
<td>
|
|
353
|
+
|
|
354
|
+
For document-reader:
|
|
355
|
+
```document-reader```
|
|
356
|
+
|
|
357
|
+
For camera-snapshot:
|
|
358
|
+
```camera-snapshot```
|
|
359
|
+
|
|
360
|
+
</td>
|
|
361
|
+
<td>
|
|
96
362
|
|
|
97
363
|
```javascript
|
|
98
|
-
|
|
364
|
+
{
|
|
365
|
+
action: "PROCESS_FINISHED",
|
|
366
|
+
data: {
|
|
367
|
+
response: { ... },
|
|
368
|
+
status: 1
|
|
369
|
+
},
|
|
370
|
+
manual: false
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
</td>
|
|
375
|
+
<td></td>
|
|
376
|
+
</tr>
|
|
377
|
+
<tr>
|
|
378
|
+
<td>The work of the component failed.</td>
|
|
379
|
+
<td>
|
|
380
|
+
|
|
381
|
+
For document-reader:
|
|
382
|
+
```document-reader```
|
|
383
|
+
|
|
384
|
+
For camera-snapshot:
|
|
385
|
+
```camera-snapshot```
|
|
386
|
+
|
|
387
|
+
</td>
|
|
388
|
+
<td>
|
|
389
|
+
|
|
390
|
+
```javascript
|
|
391
|
+
{
|
|
392
|
+
action: "PROCESS_FINISHED",
|
|
393
|
+
data: {
|
|
394
|
+
reason: "An error has occurred",
|
|
395
|
+
status: 0
|
|
396
|
+
},
|
|
397
|
+
manual: false
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
</td>
|
|
402
|
+
<td></td>
|
|
403
|
+
</tr>
|
|
404
|
+
<tr>
|
|
405
|
+
<td>Component is initialized and ready to work.</td>
|
|
406
|
+
<td>
|
|
407
|
+
|
|
408
|
+
```document-reader```
|
|
409
|
+
|
|
410
|
+
</td>
|
|
411
|
+
<td>
|
|
99
412
|
|
|
100
|
-
|
|
413
|
+
```javascript
|
|
414
|
+
{
|
|
415
|
+
action: "SERVICE_INITIALIZED",
|
|
416
|
+
data: null,
|
|
417
|
+
manual: false
|
|
418
|
+
}
|
|
101
419
|
```
|
|
102
420
|
|
|
103
|
-
|
|
421
|
+
</td>
|
|
422
|
+
<td>
|
|
423
|
+
|
|
424
|
+
This event available only in ```document-reader```.
|
|
425
|
+
|
|
426
|
+
</td>
|
|
427
|
+
</tr>
|
|
428
|
+
</tbody>
|
|
429
|
+
</table>
|
|
104
430
|
|
|
105
|
-
|
|
431
|
+
### Response
|
|
432
|
+
|
|
433
|
+
You can get the response of the component in the ```detail.data.response``` field of the event object.
|
|
106
434
|
|
|
107
435
|
For example:
|
|
108
436
|
|
|
109
437
|
```javascript
|
|
110
|
-
const component = document.
|
|
438
|
+
const component = document.querySelector('document-reader');
|
|
111
439
|
|
|
112
440
|
function listener(event) {
|
|
113
|
-
if (event.detail) {
|
|
114
|
-
const response = event.detail;
|
|
441
|
+
if (event.detail.action === 'PROCESS_FINISHED' && event.detail.data.status === 1) {
|
|
442
|
+
const response = event.detail.data.response;
|
|
115
443
|
console.log(response);
|
|
116
444
|
}
|
|
117
445
|
}
|
|
118
446
|
|
|
119
|
-
component.addEventListener('
|
|
447
|
+
component.addEventListener('document-reader', listener);
|
|
120
448
|
```
|
|
121
449
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
### document-reader
|
|
450
|
+
### Attributes
|
|
125
451
|
|
|
126
|
-
|
|
452
|
+
#### document-reader
|
|
127
453
|
|
|
128
454
|
| Attribute | Info | Data type | Default value | Values |
|
|
129
455
|
|:-------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
130
456
|
| **locale** | The language of the component interface. If empty, the language is selected from the browser settings, if it is not found, the system language is taken. | string | ```en``` | ```ru```, ```en```, ```de```, ```pl```, ```it```, ```hu```, ```ch```, ```sk```, ```uk```, ```fr```, ```es```, ```pt```, ```ar```, ```nl```, ```id```, ```vi```, ```ko```, ```ms```, ```ro```, ```gr```, ```tr```, ```jp```, ```cz```, ```th```, ```hi```, ```bn```, ```he```, ```fi```, ```sv```, ```da```, ```hr```, ```no``` |
|
|
131
|
-
|
|
|
132
|
-
| **internal-scenario** | The component document verification scenario. For more details, see the <a href="https://docs.regulaforensics.com/develop/doc-reader-sdk/web-components/getting-started#processing-scenarios" target="_blank">Web components documentation</a>. | string | ```MrzAndLocate``` | ```MrzAndLocate```, ```MrzOrLocate```, ```Mrz```, ```Locate``` |
|
|
457
|
+
| **internal-scenario** | The component document verification scenario. For more details, see the [Web components documentation](https://docs.regulaforensics.com/develop/doc-reader-sdk/web-components/getting-started#processing-scenarios). | string | ```MrzAndLocate``` | ```MrzAndLocate```, ```MrzOrLocate```, ```Mrz```, ```Locate``` |
|
|
133
458
|
| **multipage-processing** | Whether to allow processing of two pages in cases when the component detects an ID1-sized document. Multipage processing is not triggered for documents of other formats. If ```true```, the component asks for the second page and processes it. If ```false```, only one page/side of the document is processed regardless the document format. | boolean | ```false``` | ```true```, ```false``` |
|
|
134
459
|
| **start-screen** | Whether to show the start screen with two options for the document image uploading: From camera and From gallery. If ```true```, the start screen is shown. If ```false```, no start screen is shown and instead the camera of the device is turned on automatically to capture the image of the document. | boolean | ```false``` | ```true```, ```false``` |
|
|
135
460
|
| **multiple** | Whether to allow uploading more than one file via the file system. Can be set to ```true``` only if ```startScreen``` is ```true```. | boolean | ```true``` | ```true```, ```false``` |
|
|
136
|
-
| **
|
|
461
|
+
| **camera-id** | Ability to select a camera. You can get the device ID using [navigator.mediaDevices.enumerateDevices()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices). | string | ```undefined``` | ```camera id string value``` |
|
|
137
462
|
| **license** | To use the component on test environments, set the base64 license value to the ```license``` attribute. | string | ```undefined``` | ```base64 license value``` |
|
|
463
|
+
| **copyright** | Show Regula copyright footer. | boolean | ```true``` | ```true```, ```false``` |
|
|
464
|
+
| **object-fit** | Object-fit of the video element. | string | ```contain``` | ```cover```, ```contain``` |
|
|
465
|
+
| **change-camera** | Show the camera switch button. | boolean | ```false``` | ```true```, ```false``` |
|
|
138
466
|
|
|
467
|
+
#### camera-snapshot
|
|
139
468
|
|
|
140
|
-
|
|
469
|
+
| Attribute | Info | Data type | Default value | Values |
|
|
470
|
+
|:------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:---------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
471
|
+
| **locale** | The language of the component interface. If empty, the language is selected from the browser settings, if it is not found, the system language is taken. | string | ```en``` | ```ru```, ```en```, ```de```, ```pl```, ```it```, ```hu```, ```ch```, ```sk```, ```uk```, ```fr```, ```es```, ```pt```, ```ar```, ```nl```, ```id```, ```vi```, ```ko```, ```ms```, ```ro```, ```gr```, ```tr```, ```jp```, ```cz```, ```th```, ```hi```, ```bn```, ```he```, ```fi```, ```sv```, ```da```, ```hr```, ```no``` |
|
|
472
|
+
| **start-screen** | Whether to show the start screen with two options for the document image uploading: From camera and From gallery. If ```true```, the start screen is shown. If ```false```, no start screen is shown and instead the camera of the device is turned on automatically to capture the image of the document. | boolean | ```false``` | ```true```, ```false``` |
|
|
473
|
+
| **multiple** | Whether to allow uploading more than one file via the file system. Can be set to ```true``` only if ```startScreen``` is ```true```. | boolean | ```true``` | ```true```, ```false``` |
|
|
474
|
+
| **camera-id** | Ability to select a camera. You can get the device ID using [navigator.mediaDevices.enumerateDevices()](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices). | string | ```undefined``` | ```camera id string value``` |
|
|
475
|
+
| **copyright** | Show Regula copyright footer. | boolean | ```true``` | ```true```, ```false``` |
|
|
476
|
+
| **object-fit** | Object-fit of the video element. | string | ```contain``` | ```cover```, ```contain``` |
|
|
477
|
+
| **change-camera** | Show the camera switch button. | boolean | ```false``` | ```true```, ```false``` |
|
|
141
478
|
|
|
142
|
-
|
|
143
|
-
|:-----------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------:|:-------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|
144
|
-
| **locale** | The language of the component interface. If empty, the language is selected from the browser settings, if it is not found, the system language is taken. | string | ```en``` | ```ru```, ```en```, ```de```, ```pl```, ```it```, ```hu```, ```ch```, ```sk```, ```uk```, ```fr```, ```es```, ```pt```, ```ar```, ```nl```, ```id```, ```vi```, ```ko```, ```ms```, ```ro```, ```gr```, ```tr```, ```jp```, ```cz```, ```th```, ```hi```, ```bn```, ```he```, ```fi```, ```sv```, ```da```, ```hr```, ```no``` |
|
|
145
|
-
| **start-screen** | Whether to show the start screen with two options for the document image uploading: From camera and From gallery. If ```true```, the start screen is shown. If ```false```, no start screen is shown and instead the camera of the device is turned on automatically to capture the image of the document. | boolean | ```false``` | ```true```, ```false``` |
|
|
146
|
-
| **multiple** | Whether to allow uploading more than one file via the file system. Can be set to ```true``` only if ```startScreen``` is ```true```. | boolean | ```true``` | ```true```, ```false``` |
|
|
147
|
-
| **full-screen** | Whether to locate the video element on the whole screen. If ```true```, the video element expands to full screen. If ```false```, the video element is displayed in the frame of the container. | boolean | ```false``` | ```true```, ```false``` |
|
|
148
|
-
|
|
149
|
-
## Components customization
|
|
479
|
+
### Customization
|
|
150
480
|
|
|
151
481
|
Using CSS variables, you can change the font and the main colors of the components.
|
|
152
482
|
|
|
153
|
-
| Variable
|
|
154
|
-
|
|
155
|
-
| **--font-family**
|
|
156
|
-
| **--font-size**
|
|
157
|
-
| **--main-color**
|
|
483
|
+
| Variable | Info | Default value |
|
|
484
|
+
|:-------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------:|
|
|
485
|
+
| **--font-family** | The font family of all text elements. If you change the font family, make sure to adjust the fond size so the message on the start screen would fit the frame. | ```Noto Sans, sans-serif``` |
|
|
486
|
+
| **--font-size** | The font size for the text elements. | ```16px``` |
|
|
487
|
+
| **--main-color** | Color for the graphic elements of the component. By default, the brand Regula violet is set. | ```#663399``` |
|
|
488
|
+
| **--hover-color** | Buttons hover color. | ```#7c45b4``` |
|
|
489
|
+
| **--active-color** | Buttons active color. | ```#663399``` |
|
|
158
490
|
|
|
159
491
|
For example:
|
|
160
492
|
|
|
@@ -170,9 +502,256 @@ CSS:
|
|
|
170
502
|
HTML:
|
|
171
503
|
|
|
172
504
|
```html
|
|
173
|
-
<
|
|
505
|
+
<document-reader class="my-custom-style"></document-reader>
|
|
174
506
|
```
|
|
175
507
|
|
|
508
|
+
## Document reader SDK
|
|
509
|
+
|
|
510
|
+
You can use the document-reader SDK to create your own UI interface.
|
|
511
|
+
|
|
512
|
+
### SDK integration via NPM
|
|
513
|
+
|
|
514
|
+
Install ```@regulaforensics/vp-frontend-document-components```:
|
|
515
|
+
|
|
516
|
+
```
|
|
517
|
+
npm i @regulaforensics/vp-frontend-document-components
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Import ```DocumentReaderProcessor``` from ```@regulaforensics/vp-frontend-document-components``` into your ```.js``` file:
|
|
521
|
+
|
|
522
|
+
```javascript
|
|
523
|
+
import { DocumentReaderProcessor } from '@regulaforensics/vp-frontend-document-components'; // If you use module bundler. In other cases use full path '/node_modules/@regulaforensics/vp-frontend-document-components/esm/main.js'.
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
Add video tag to ```.html``` file then prepare and initialize ```DocumentReaderProcessor```:
|
|
527
|
+
|
|
528
|
+
```javascript
|
|
529
|
+
const videoElement = document.getElementById('yourVideoElement');
|
|
530
|
+
const processor = new DocumentReaderProcessor(videoElement);
|
|
531
|
+
|
|
532
|
+
try {
|
|
533
|
+
await processor.prepare();
|
|
534
|
+
await processor.initialize({license: 'BASE64_LICENSE_KEY'}); // Set license object ONLY on test environments. In the production build call initialize(); without a license object.
|
|
535
|
+
|
|
536
|
+
const result = await processor.startRecognition(); // Result of the document recognition will be located here.
|
|
537
|
+
|
|
538
|
+
processor.stopRecognition();
|
|
539
|
+
|
|
540
|
+
console.log(result);
|
|
541
|
+
} catch (e) {
|
|
542
|
+
console.log(e);
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
### SDK integration via CDN
|
|
547
|
+
|
|
548
|
+
Connect the script in your ```.html``` file. CDN link: ```unpkg.com/:package@:version/:file```
|
|
549
|
+
|
|
550
|
+
For example:
|
|
551
|
+
|
|
552
|
+
```html
|
|
553
|
+
<!-- Replace <VERSION> with the package version. The list of versions is available on NPM in the versions section -->
|
|
554
|
+
<script src="https://unpkg.com/@regulaforensics/vp-frontend-document-components@<VERSION>/dist/main.js"></script>
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
Add video tag to ```.html``` file then prepare and initialize ```DocumentReaderProcessor```. ```DocumentReaderProcessor``` is available in the global variable ```window.Regula```:
|
|
558
|
+
|
|
559
|
+
```javascript
|
|
560
|
+
const { DocumentReaderProcessor } = window.Regula;
|
|
561
|
+
|
|
562
|
+
const videoElement = document.getElementById('yourVideoElement');
|
|
563
|
+
const processor = new DocumentReaderProcessor(videoElement);
|
|
564
|
+
|
|
565
|
+
try {
|
|
566
|
+
await processor.prepare();
|
|
567
|
+
await processor.initialize({license: 'BASE64_LICENSE_KEY'}); // Set license object ONLY on test environments. In the production build call initialize(); without a license object.
|
|
568
|
+
|
|
569
|
+
const result = await processor.startRecognition(); // Result of the document recognition will be located here.
|
|
570
|
+
|
|
571
|
+
processor.stopRecognition();
|
|
572
|
+
|
|
573
|
+
console.log(result);
|
|
574
|
+
} catch (e) {
|
|
575
|
+
console.log(e);
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
### Available DocumentReaderProcessor methods
|
|
580
|
+
|
|
581
|
+
#### prepare
|
|
582
|
+
|
|
583
|
+
Prepares SDK files. The method must be run before initialization:
|
|
584
|
+
|
|
585
|
+
```javascript
|
|
586
|
+
await processor.prepare();
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
#### initialize
|
|
590
|
+
|
|
591
|
+
Initializes the processor. The method must be run after preparing. Accepts an object with a base64 license. An object with a license must be installed only to work on test environments. Do not install an object with a license in production mode:
|
|
592
|
+
|
|
593
|
+
```javascript
|
|
594
|
+
await processor.initialize({license: 'BASE64_LICENSE_KEY'});
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
#### startRecognition
|
|
598
|
+
|
|
599
|
+
The method starts the video stream and starts the process of recognizing the document. Returns the result of document processing:
|
|
600
|
+
|
|
601
|
+
```javascript
|
|
602
|
+
const result = await processor.startRecognition();
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
To process multi-page documents, add the callback function to the method. The callback function takes in an object with an intermediate result of processing, a method for starting the next page and a method for completing the process:
|
|
606
|
+
|
|
607
|
+
```javascript
|
|
608
|
+
/**
|
|
609
|
+
* @param {object} currentPage - Page data.
|
|
610
|
+
* @param {object} currentPage.data - Page processing result.
|
|
611
|
+
* @param {function} currentPage.startNextPage - The method of starting the recognition of the next page.
|
|
612
|
+
* @param {function} currentPage.finishRecognition - Finish the process and return the result.
|
|
613
|
+
*/
|
|
614
|
+
|
|
615
|
+
async function pageListener(currentPage) {
|
|
616
|
+
|
|
617
|
+
setTimeout(async () => {
|
|
618
|
+
await currentPage.startNextPage(); // Will start recognition of the next page in 3 seconds.
|
|
619
|
+
}, 3000); // During this time, you can tell the user to turn the document over.
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
const result = await processor.startRecognition(pageListener);
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
#### processImage
|
|
626
|
+
|
|
627
|
+
Processes document files. Can process ```FileList``` or ```Blob``` array:
|
|
628
|
+
|
|
629
|
+
```javascript
|
|
630
|
+
const file = 'FileList or Blob array';
|
|
631
|
+
|
|
632
|
+
const result = await processor.processImage(file);
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
#### stopRecognition
|
|
636
|
+
|
|
637
|
+
Stops the document recognition process and ends the video stream.
|
|
638
|
+
|
|
639
|
+
```javascript
|
|
640
|
+
processor.stopRecognition();
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### DocumentReaderProcessor settings
|
|
644
|
+
|
|
645
|
+
You can change the default settings for video streaming and document recognition. The settings must be set before the document recognition process.
|
|
646
|
+
|
|
647
|
+
#### streamParam
|
|
648
|
+
|
|
649
|
+
Sets the video stream settings:
|
|
650
|
+
|
|
651
|
+
```javascript
|
|
652
|
+
processor.streamParam = {
|
|
653
|
+
cameraMode: 'user', // Camera facing mode. Can be 'environment' or 'user'. By default 'user'.
|
|
654
|
+
preferredCameraId: '', // Selecting a camera by ID. The camera ID can be obtained using navigator.mediaDevices.enumerateDevices();. Not set by default.
|
|
655
|
+
resolution: { // Video resolution. By default 1280x720.
|
|
656
|
+
width: 1280,
|
|
657
|
+
height: 720,
|
|
658
|
+
},
|
|
659
|
+
}
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
#### recognizerProcessParam
|
|
663
|
+
|
|
664
|
+
Sets the settings for recognizing a document from the camera (```startRecognition``` method):
|
|
665
|
+
|
|
666
|
+
```javascript
|
|
667
|
+
processor.recognizerProcessParam = {
|
|
668
|
+
processParam: {
|
|
669
|
+
returnUncroppedImage: true, // When enabled, returns input images in output. Disabled by default.
|
|
670
|
+
scenario: 'MrzAndLocate', // Recognition scenario. Can be 'MrzAndLocate', 'MrzOrLocate', 'Mrz', 'Locate'. By default 'MrzAndLocate'.
|
|
671
|
+
multipageProcessing: true, // Enables multi-page document processing mode. By default false.
|
|
672
|
+
timeout: 20000, // Recognition timeout in milliseconds. After this time process will be finished. By default 20000.
|
|
673
|
+
resultTypeOutput: [], // Types of results to return in response. By default [] - all available types.
|
|
674
|
+
imageQa: { // Quality checks.
|
|
675
|
+
expectedPass: ['dpiThreshold', 'glaresCheck'],
|
|
676
|
+
dpiThreshold: 130,
|
|
677
|
+
glaresCheck: true,
|
|
678
|
+
glaresCheckParams: {
|
|
679
|
+
imgMarginPart: 0.05,
|
|
680
|
+
maxGlaringPart: 0.01,
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
},
|
|
684
|
+
}
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
#### imageProcessParam
|
|
688
|
+
|
|
689
|
+
Sets the settings for recognizing a document as a file (```processImage``` method):
|
|
690
|
+
|
|
691
|
+
```javascript
|
|
692
|
+
processor.imageProcessParam = {
|
|
693
|
+
processParam: {
|
|
694
|
+
returnUncroppedImage: true, // When enabled, returns input images in output. Disabled by default.
|
|
695
|
+
scenario: 'MrzAndLocate', // Recognition scenario. Can be 'MrzAndLocate', 'MrzOrLocate', 'Mrz', 'Locate'. By default 'MrzAndLocate'.
|
|
696
|
+
resultTypeOutput: [], // Types of results to return in response. By default [] - all available types.
|
|
697
|
+
},
|
|
698
|
+
}
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
#### recognizeListener
|
|
702
|
+
|
|
703
|
+
Sets the callback function that takes in the processing result for each frame:
|
|
704
|
+
|
|
705
|
+
```javascript
|
|
706
|
+
/**
|
|
707
|
+
* @param {object} response - The result of processing each frame.
|
|
708
|
+
*/
|
|
709
|
+
|
|
710
|
+
function listener(response) {
|
|
711
|
+
console.log(response);
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
processor.recognizeListener = listener; // Not set by default.
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
#### videoElement
|
|
718
|
+
|
|
719
|
+
Sets the video element to display the video stream from the camera. This setting will change the video element that you set when creating the instance ```new DocumentReaderProcessor(videoElement)```:
|
|
720
|
+
|
|
721
|
+
```javascript
|
|
722
|
+
const videoElement = document.getElementById('HTMLVideoElement');
|
|
723
|
+
|
|
724
|
+
processor.videoElement = videoElement; // By default null.
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
#### isPrepared
|
|
728
|
+
|
|
729
|
+
Read-only property. Returns true if the processor has been prepared.
|
|
730
|
+
|
|
731
|
+
```javascript
|
|
732
|
+
processor.isPrepared; // True or false.
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
#### isInitialized
|
|
736
|
+
|
|
737
|
+
Read-only property. Returns true if the processor has been initialized.
|
|
738
|
+
|
|
739
|
+
```javascript
|
|
740
|
+
processor.isInitialized; // True or false.
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
#### isProcessing
|
|
744
|
+
|
|
745
|
+
Read-only property. Returns true if document recognition is not completed.
|
|
746
|
+
|
|
747
|
+
```javascript
|
|
748
|
+
processor.isProcessing; // True or false.
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
## Problems
|
|
752
|
+
|
|
753
|
+
UI components and SDK use the ```getUserMedia``` method to display the video stream from the camera. This feature is available only in secure contexts (HTTPS).
|
|
754
|
+
|
|
176
755
|
## Examples
|
|
177
756
|
|
|
178
757
|
You can see the examples of using the components on the [Samples page](https://github.com/regulaforensics/document-web-components-samples).
|