capacitor-plugin-camera-forked 2.0.8
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/CapacitorPluginCameraForked.podspec +17 -0
- package/LICENSE +21 -0
- package/README.md +513 -0
- package/android/build.gradle +66 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/tonyxlh/capacitor/camera/BitmapUtils.java +210 -0
- package/android/src/main/java/com/tonyxlh/capacitor/camera/CameraPreviewPlugin.java +834 -0
- package/android/src/main/java/com/tonyxlh/capacitor/camera/FrameMetadata.java +70 -0
- package/android/src/main/java/com/tonyxlh/capacitor/camera/ScanRegion.java +16 -0
- package/android/src/main/res/.gitkeep +0 -0
- package/dist/docs.json +495 -0
- package/dist/esm/definitions.d.ts +123 -0
- package/dist/esm/definitions.js +10 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +85 -0
- package/dist/esm/web.js +427 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +456 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +457 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/CameraPreview.swift +8 -0
- package/ios/Plugin/CameraPreviewPlugin.h +10 -0
- package/ios/Plugin/CameraPreviewPlugin.m +29 -0
- package/ios/Plugin/CameraPreviewPlugin.swift +670 -0
- package/ios/Plugin/Info.plist +24 -0
- package/ios/Plugin/PreviewView.swift +22 -0
- package/ios/Plugin/ScanRegion.swift +17 -0
- package/package.json +89 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
package com.tonyxlh.capacitor.camera;
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright 2020 Google LLC. All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Describing a frame info. */
|
|
20
|
+
public class FrameMetadata {
|
|
21
|
+
|
|
22
|
+
private final int width;
|
|
23
|
+
private final int height;
|
|
24
|
+
private final int rotation;
|
|
25
|
+
|
|
26
|
+
public int getWidth() {
|
|
27
|
+
return width;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public int getHeight() {
|
|
31
|
+
return height;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public int getRotation() {
|
|
35
|
+
return rotation;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private FrameMetadata(int width, int height, int rotation) {
|
|
39
|
+
this.width = width;
|
|
40
|
+
this.height = height;
|
|
41
|
+
this.rotation = rotation;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Builder of {@link FrameMetadata}. */
|
|
45
|
+
public static class Builder {
|
|
46
|
+
|
|
47
|
+
private int width;
|
|
48
|
+
private int height;
|
|
49
|
+
private int rotation;
|
|
50
|
+
|
|
51
|
+
public Builder setWidth(int width) {
|
|
52
|
+
this.width = width;
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public Builder setHeight(int height) {
|
|
57
|
+
this.height = height;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public Builder setRotation(int rotation) {
|
|
62
|
+
this.rotation = rotation;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
public FrameMetadata build() {
|
|
67
|
+
return new FrameMetadata(width, height, rotation);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package com.tonyxlh.capacitor.camera;
|
|
2
|
+
|
|
3
|
+
public class ScanRegion {
|
|
4
|
+
public int top;
|
|
5
|
+
public int bottom;
|
|
6
|
+
public int left;
|
|
7
|
+
public int right;
|
|
8
|
+
public int measuredByPercentage;
|
|
9
|
+
public ScanRegion(int top,int bottom,int left,int right,int measuredByPercentage) {
|
|
10
|
+
this.top = top;
|
|
11
|
+
this.bottom = bottom;
|
|
12
|
+
this.left = left;
|
|
13
|
+
this.right = right;
|
|
14
|
+
this.measuredByPercentage = measuredByPercentage;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
File without changes
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "CameraPreviewPlugin",
|
|
4
|
+
"slug": "camerapreviewplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "initialize",
|
|
10
|
+
"signature": "() => Promise<void>",
|
|
11
|
+
"parameters": [],
|
|
12
|
+
"returns": "Promise<void>",
|
|
13
|
+
"tags": [],
|
|
14
|
+
"docs": "",
|
|
15
|
+
"complexTypes": [],
|
|
16
|
+
"slug": "initialize"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "getResolution",
|
|
20
|
+
"signature": "() => Promise<{ resolution: string; }>",
|
|
21
|
+
"parameters": [],
|
|
22
|
+
"returns": "Promise<{ resolution: string; }>",
|
|
23
|
+
"tags": [],
|
|
24
|
+
"docs": "",
|
|
25
|
+
"complexTypes": [],
|
|
26
|
+
"slug": "getresolution"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "setResolution",
|
|
30
|
+
"signature": "(options: { resolution: number; }) => Promise<void>",
|
|
31
|
+
"parameters": [
|
|
32
|
+
{
|
|
33
|
+
"name": "options",
|
|
34
|
+
"docs": "",
|
|
35
|
+
"type": "{ resolution: number; }"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"returns": "Promise<void>",
|
|
39
|
+
"tags": [],
|
|
40
|
+
"docs": "",
|
|
41
|
+
"complexTypes": [],
|
|
42
|
+
"slug": "setresolution"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "getAllCameras",
|
|
46
|
+
"signature": "() => Promise<{ cameras: string[]; }>",
|
|
47
|
+
"parameters": [],
|
|
48
|
+
"returns": "Promise<{ cameras: string[]; }>",
|
|
49
|
+
"tags": [],
|
|
50
|
+
"docs": "",
|
|
51
|
+
"complexTypes": [],
|
|
52
|
+
"slug": "getallcameras"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "getSelectedCamera",
|
|
56
|
+
"signature": "() => Promise<{ selectedCamera: string; }>",
|
|
57
|
+
"parameters": [],
|
|
58
|
+
"returns": "Promise<{ selectedCamera: string; }>",
|
|
59
|
+
"tags": [],
|
|
60
|
+
"docs": "",
|
|
61
|
+
"complexTypes": [],
|
|
62
|
+
"slug": "getselectedcamera"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "selectCamera",
|
|
66
|
+
"signature": "(options: { cameraID: string; }) => Promise<void>",
|
|
67
|
+
"parameters": [
|
|
68
|
+
{
|
|
69
|
+
"name": "options",
|
|
70
|
+
"docs": "",
|
|
71
|
+
"type": "{ cameraID: string; }"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"returns": "Promise<void>",
|
|
75
|
+
"tags": [],
|
|
76
|
+
"docs": "",
|
|
77
|
+
"complexTypes": [],
|
|
78
|
+
"slug": "selectcamera"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "setScanRegion",
|
|
82
|
+
"signature": "(options: { region: ScanRegion; }) => Promise<void>",
|
|
83
|
+
"parameters": [
|
|
84
|
+
{
|
|
85
|
+
"name": "options",
|
|
86
|
+
"docs": "",
|
|
87
|
+
"type": "{ region: ScanRegion; }"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"returns": "Promise<void>",
|
|
91
|
+
"tags": [],
|
|
92
|
+
"docs": "",
|
|
93
|
+
"complexTypes": [
|
|
94
|
+
"ScanRegion"
|
|
95
|
+
],
|
|
96
|
+
"slug": "setscanregion"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "setZoom",
|
|
100
|
+
"signature": "(options: { factor: number; }) => Promise<void>",
|
|
101
|
+
"parameters": [
|
|
102
|
+
{
|
|
103
|
+
"name": "options",
|
|
104
|
+
"docs": "",
|
|
105
|
+
"type": "{ factor: number; }"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"returns": "Promise<void>",
|
|
109
|
+
"tags": [],
|
|
110
|
+
"docs": "",
|
|
111
|
+
"complexTypes": [],
|
|
112
|
+
"slug": "setzoom"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "setFocus",
|
|
116
|
+
"signature": "(options: { x: number; y: number; }) => Promise<void>",
|
|
117
|
+
"parameters": [
|
|
118
|
+
{
|
|
119
|
+
"name": "options",
|
|
120
|
+
"docs": "",
|
|
121
|
+
"type": "{ x: number; y: number; }"
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"returns": "Promise<void>",
|
|
125
|
+
"tags": [],
|
|
126
|
+
"docs": "",
|
|
127
|
+
"complexTypes": [],
|
|
128
|
+
"slug": "setfocus"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"name": "setDefaultUIElementURL",
|
|
132
|
+
"signature": "(url: string) => Promise<void>",
|
|
133
|
+
"parameters": [
|
|
134
|
+
{
|
|
135
|
+
"name": "url",
|
|
136
|
+
"docs": "",
|
|
137
|
+
"type": "string"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"returns": "Promise<void>",
|
|
141
|
+
"tags": [],
|
|
142
|
+
"docs": "Web Only",
|
|
143
|
+
"complexTypes": [],
|
|
144
|
+
"slug": "setdefaultuielementurl"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "setElement",
|
|
148
|
+
"signature": "(ele: any) => Promise<void>",
|
|
149
|
+
"parameters": [
|
|
150
|
+
{
|
|
151
|
+
"name": "ele",
|
|
152
|
+
"docs": "",
|
|
153
|
+
"type": "any"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"returns": "Promise<void>",
|
|
157
|
+
"tags": [],
|
|
158
|
+
"docs": "Web Only",
|
|
159
|
+
"complexTypes": [
|
|
160
|
+
"HTMLElement"
|
|
161
|
+
],
|
|
162
|
+
"slug": "setelement"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "startCamera",
|
|
166
|
+
"signature": "() => Promise<void>",
|
|
167
|
+
"parameters": [],
|
|
168
|
+
"returns": "Promise<void>",
|
|
169
|
+
"tags": [],
|
|
170
|
+
"docs": "",
|
|
171
|
+
"complexTypes": [],
|
|
172
|
+
"slug": "startcamera"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "stopCamera",
|
|
176
|
+
"signature": "() => Promise<void>",
|
|
177
|
+
"parameters": [],
|
|
178
|
+
"returns": "Promise<void>",
|
|
179
|
+
"tags": [],
|
|
180
|
+
"docs": "",
|
|
181
|
+
"complexTypes": [],
|
|
182
|
+
"slug": "stopcamera"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"name": "takeSnapshot",
|
|
186
|
+
"signature": "(options: { quality?: number; }) => Promise<{ base64: string; }>",
|
|
187
|
+
"parameters": [
|
|
188
|
+
{
|
|
189
|
+
"name": "options",
|
|
190
|
+
"docs": "",
|
|
191
|
+
"type": "{ quality?: number | undefined; }"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"returns": "Promise<{ base64: string; }>",
|
|
195
|
+
"tags": [],
|
|
196
|
+
"docs": "take a snapshot as base64.",
|
|
197
|
+
"complexTypes": [],
|
|
198
|
+
"slug": "takesnapshot"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"name": "saveFrame",
|
|
202
|
+
"signature": "() => Promise<{ success: boolean; }>",
|
|
203
|
+
"parameters": [],
|
|
204
|
+
"returns": "Promise<{ success: boolean; }>",
|
|
205
|
+
"tags": [],
|
|
206
|
+
"docs": "save a frame internally. Android and iOS only.",
|
|
207
|
+
"complexTypes": [],
|
|
208
|
+
"slug": "saveframe"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"name": "takeSnapshot2",
|
|
212
|
+
"signature": "(options: { canvas: HTMLCanvasElement; maxLength?: number; }) => Promise<{ scaleRatio?: number; }>",
|
|
213
|
+
"parameters": [
|
|
214
|
+
{
|
|
215
|
+
"name": "options",
|
|
216
|
+
"docs": "",
|
|
217
|
+
"type": "{ canvas: any; maxLength?: number | undefined; }"
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"returns": "Promise<{ scaleRatio?: number | undefined; }>",
|
|
221
|
+
"tags": [],
|
|
222
|
+
"docs": "take a snapshot on to a canvas. Web Only",
|
|
223
|
+
"complexTypes": [
|
|
224
|
+
"HTMLCanvasElement"
|
|
225
|
+
],
|
|
226
|
+
"slug": "takesnapshot2"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"name": "takePhoto",
|
|
230
|
+
"signature": "(options: { pathToSave?: string; includeBase64?: boolean; }) => Promise<{ path?: string; base64?: string; blob?: Blob; }>",
|
|
231
|
+
"parameters": [
|
|
232
|
+
{
|
|
233
|
+
"name": "options",
|
|
234
|
+
"docs": "",
|
|
235
|
+
"type": "{ pathToSave?: string | undefined; includeBase64?: boolean | undefined; }"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"returns": "Promise<{ path?: string | undefined; base64?: string | undefined; blob?: any; }>",
|
|
239
|
+
"tags": [],
|
|
240
|
+
"docs": "",
|
|
241
|
+
"complexTypes": [
|
|
242
|
+
"Blob"
|
|
243
|
+
],
|
|
244
|
+
"slug": "takephoto"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"name": "toggleTorch",
|
|
248
|
+
"signature": "(options: { on: boolean; }) => Promise<void>",
|
|
249
|
+
"parameters": [
|
|
250
|
+
{
|
|
251
|
+
"name": "options",
|
|
252
|
+
"docs": "",
|
|
253
|
+
"type": "{ on: boolean; }"
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
"returns": "Promise<void>",
|
|
257
|
+
"tags": [],
|
|
258
|
+
"docs": "",
|
|
259
|
+
"complexTypes": [],
|
|
260
|
+
"slug": "toggletorch"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "getOrientation",
|
|
264
|
+
"signature": "() => Promise<{ \"orientation\": \"PORTRAIT\" | \"LANDSCAPE\"; }>",
|
|
265
|
+
"parameters": [],
|
|
266
|
+
"returns": "Promise<{ orientation: 'PORTRAIT' | 'LANDSCAPE'; }>",
|
|
267
|
+
"tags": [],
|
|
268
|
+
"docs": "get the orientation of the device.",
|
|
269
|
+
"complexTypes": [],
|
|
270
|
+
"slug": "getorientation"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "startRecording",
|
|
274
|
+
"signature": "() => Promise<void>",
|
|
275
|
+
"parameters": [],
|
|
276
|
+
"returns": "Promise<void>",
|
|
277
|
+
"tags": [],
|
|
278
|
+
"docs": "",
|
|
279
|
+
"complexTypes": [],
|
|
280
|
+
"slug": "startrecording"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "stopRecording",
|
|
284
|
+
"signature": "(options: { includeBase64?: boolean; }) => Promise<{ path?: string; base64?: string; blob?: Blob; }>",
|
|
285
|
+
"parameters": [
|
|
286
|
+
{
|
|
287
|
+
"name": "options",
|
|
288
|
+
"docs": "",
|
|
289
|
+
"type": "{ includeBase64?: boolean | undefined; }"
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"returns": "Promise<{ path?: string | undefined; base64?: string | undefined; blob?: any; }>",
|
|
293
|
+
"tags": [],
|
|
294
|
+
"docs": "",
|
|
295
|
+
"complexTypes": [
|
|
296
|
+
"Blob"
|
|
297
|
+
],
|
|
298
|
+
"slug": "stoprecording"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"name": "setLayout",
|
|
302
|
+
"signature": "(options: { top: string; left: string; width: string; height: string; }) => Promise<void>",
|
|
303
|
+
"parameters": [
|
|
304
|
+
{
|
|
305
|
+
"name": "options",
|
|
306
|
+
"docs": "",
|
|
307
|
+
"type": "{ top: string; left: string; width: string; height: string; }"
|
|
308
|
+
}
|
|
309
|
+
],
|
|
310
|
+
"returns": "Promise<void>",
|
|
311
|
+
"tags": [],
|
|
312
|
+
"docs": "",
|
|
313
|
+
"complexTypes": [],
|
|
314
|
+
"slug": "setlayout"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"name": "requestCameraPermission",
|
|
318
|
+
"signature": "() => Promise<void>",
|
|
319
|
+
"parameters": [],
|
|
320
|
+
"returns": "Promise<void>",
|
|
321
|
+
"tags": [],
|
|
322
|
+
"docs": "",
|
|
323
|
+
"complexTypes": [],
|
|
324
|
+
"slug": "requestcamerapermission"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"name": "requestMicroPhonePermission",
|
|
328
|
+
"signature": "() => Promise<void>",
|
|
329
|
+
"parameters": [],
|
|
330
|
+
"returns": "Promise<void>",
|
|
331
|
+
"tags": [],
|
|
332
|
+
"docs": "",
|
|
333
|
+
"complexTypes": [],
|
|
334
|
+
"slug": "requestmicrophonepermission"
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"name": "isOpen",
|
|
338
|
+
"signature": "() => Promise<{ isOpen: boolean; }>",
|
|
339
|
+
"parameters": [],
|
|
340
|
+
"returns": "Promise<{ isOpen: boolean; }>",
|
|
341
|
+
"tags": [],
|
|
342
|
+
"docs": "",
|
|
343
|
+
"complexTypes": [],
|
|
344
|
+
"slug": "isopen"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
"name": "addListener",
|
|
348
|
+
"signature": "(eventName: 'onPlayed', listenerFunc: onPlayedListener) => Promise<PluginListenerHandle>",
|
|
349
|
+
"parameters": [
|
|
350
|
+
{
|
|
351
|
+
"name": "eventName",
|
|
352
|
+
"docs": "",
|
|
353
|
+
"type": "'onPlayed'"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"name": "listenerFunc",
|
|
357
|
+
"docs": "",
|
|
358
|
+
"type": "onPlayedListener"
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
362
|
+
"tags": [],
|
|
363
|
+
"docs": "",
|
|
364
|
+
"complexTypes": [
|
|
365
|
+
"PluginListenerHandle",
|
|
366
|
+
"onPlayedListener"
|
|
367
|
+
],
|
|
368
|
+
"slug": "addlisteneronplayed"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"name": "addListener",
|
|
372
|
+
"signature": "(eventName: 'onOrientationChanged', listenerFunc: onOrientationChangedListener) => Promise<PluginListenerHandle>",
|
|
373
|
+
"parameters": [
|
|
374
|
+
{
|
|
375
|
+
"name": "eventName",
|
|
376
|
+
"docs": "",
|
|
377
|
+
"type": "'onOrientationChanged'"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"name": "listenerFunc",
|
|
381
|
+
"docs": "",
|
|
382
|
+
"type": "onOrientationChangedListener"
|
|
383
|
+
}
|
|
384
|
+
],
|
|
385
|
+
"returns": "Promise<PluginListenerHandle>",
|
|
386
|
+
"tags": [],
|
|
387
|
+
"docs": "",
|
|
388
|
+
"complexTypes": [
|
|
389
|
+
"PluginListenerHandle",
|
|
390
|
+
"onOrientationChangedListener"
|
|
391
|
+
],
|
|
392
|
+
"slug": "addlisteneronorientationchanged"
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"name": "removeAllListeners",
|
|
396
|
+
"signature": "() => Promise<void>",
|
|
397
|
+
"parameters": [],
|
|
398
|
+
"returns": "Promise<void>",
|
|
399
|
+
"tags": [],
|
|
400
|
+
"docs": "",
|
|
401
|
+
"complexTypes": [],
|
|
402
|
+
"slug": "removealllisteners"
|
|
403
|
+
}
|
|
404
|
+
],
|
|
405
|
+
"properties": []
|
|
406
|
+
},
|
|
407
|
+
"interfaces": [
|
|
408
|
+
{
|
|
409
|
+
"name": "ScanRegion",
|
|
410
|
+
"slug": "scanregion",
|
|
411
|
+
"docs": "measuredByPercentage: 0 in pixel, 1 in percent",
|
|
412
|
+
"tags": [],
|
|
413
|
+
"methods": [],
|
|
414
|
+
"properties": [
|
|
415
|
+
{
|
|
416
|
+
"name": "left",
|
|
417
|
+
"tags": [],
|
|
418
|
+
"docs": "",
|
|
419
|
+
"complexTypes": [],
|
|
420
|
+
"type": "number"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"name": "top",
|
|
424
|
+
"tags": [],
|
|
425
|
+
"docs": "",
|
|
426
|
+
"complexTypes": [],
|
|
427
|
+
"type": "number"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"name": "right",
|
|
431
|
+
"tags": [],
|
|
432
|
+
"docs": "",
|
|
433
|
+
"complexTypes": [],
|
|
434
|
+
"type": "number"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"name": "bottom",
|
|
438
|
+
"tags": [],
|
|
439
|
+
"docs": "",
|
|
440
|
+
"complexTypes": [],
|
|
441
|
+
"type": "number"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "measuredByPercentage",
|
|
445
|
+
"tags": [],
|
|
446
|
+
"docs": "",
|
|
447
|
+
"complexTypes": [],
|
|
448
|
+
"type": "number"
|
|
449
|
+
}
|
|
450
|
+
]
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"name": "PluginListenerHandle",
|
|
454
|
+
"slug": "pluginlistenerhandle",
|
|
455
|
+
"docs": "",
|
|
456
|
+
"tags": [],
|
|
457
|
+
"methods": [],
|
|
458
|
+
"properties": [
|
|
459
|
+
{
|
|
460
|
+
"name": "remove",
|
|
461
|
+
"tags": [],
|
|
462
|
+
"docs": "",
|
|
463
|
+
"complexTypes": [],
|
|
464
|
+
"type": "() => Promise<void>"
|
|
465
|
+
}
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
],
|
|
469
|
+
"enums": [],
|
|
470
|
+
"typeAliases": [
|
|
471
|
+
{
|
|
472
|
+
"name": "onPlayedListener",
|
|
473
|
+
"slug": "onplayedlistener",
|
|
474
|
+
"docs": "",
|
|
475
|
+
"types": [
|
|
476
|
+
{
|
|
477
|
+
"text": "(result: { resolution: string; }): void",
|
|
478
|
+
"complexTypes": []
|
|
479
|
+
}
|
|
480
|
+
]
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"name": "onOrientationChangedListener",
|
|
484
|
+
"slug": "onorientationchangedlistener",
|
|
485
|
+
"docs": "",
|
|
486
|
+
"types": [
|
|
487
|
+
{
|
|
488
|
+
"text": "(): void",
|
|
489
|
+
"complexTypes": []
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
"pluginConfigs": []
|
|
495
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { PluginListenerHandle } from "@capacitor/core";
|
|
2
|
+
export interface CameraPreviewPlugin {
|
|
3
|
+
initialize(): Promise<void>;
|
|
4
|
+
getResolution(): Promise<{
|
|
5
|
+
resolution: string;
|
|
6
|
+
}>;
|
|
7
|
+
setResolution(options: {
|
|
8
|
+
resolution: number;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
getAllCameras(): Promise<{
|
|
11
|
+
cameras: string[];
|
|
12
|
+
}>;
|
|
13
|
+
getSelectedCamera(): Promise<{
|
|
14
|
+
selectedCamera: string;
|
|
15
|
+
}>;
|
|
16
|
+
selectCamera(options: {
|
|
17
|
+
cameraID: string;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
setScanRegion(options: {
|
|
20
|
+
region: ScanRegion;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
setZoom(options: {
|
|
23
|
+
factor: number;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
setFocus(options: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Web Only
|
|
31
|
+
*/
|
|
32
|
+
setDefaultUIElementURL(url: string): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Web Only
|
|
35
|
+
*/
|
|
36
|
+
setElement(ele: HTMLElement): Promise<void>;
|
|
37
|
+
startCamera(): Promise<void>;
|
|
38
|
+
stopCamera(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* take a snapshot as base64.
|
|
41
|
+
*/
|
|
42
|
+
takeSnapshot(options: {
|
|
43
|
+
quality?: number;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
base64: string;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* save a frame internally. Android and iOS only.
|
|
49
|
+
*/
|
|
50
|
+
saveFrame(): Promise<{
|
|
51
|
+
success: boolean;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* take a snapshot on to a canvas. Web Only
|
|
55
|
+
*/
|
|
56
|
+
takeSnapshot2(options: {
|
|
57
|
+
canvas: HTMLCanvasElement;
|
|
58
|
+
maxLength?: number;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
scaleRatio?: number;
|
|
61
|
+
}>;
|
|
62
|
+
takePhoto(options: {
|
|
63
|
+
pathToSave?: string;
|
|
64
|
+
includeBase64?: boolean;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
path?: string;
|
|
67
|
+
base64?: string;
|
|
68
|
+
blob?: Blob;
|
|
69
|
+
}>;
|
|
70
|
+
toggleTorch(options: {
|
|
71
|
+
on: boolean;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* get the orientation of the device.
|
|
75
|
+
*/
|
|
76
|
+
getOrientation(): Promise<{
|
|
77
|
+
"orientation": "PORTRAIT" | "LANDSCAPE";
|
|
78
|
+
}>;
|
|
79
|
+
startRecording(): Promise<void>;
|
|
80
|
+
stopRecording(options: {
|
|
81
|
+
includeBase64?: boolean;
|
|
82
|
+
}): Promise<{
|
|
83
|
+
path?: string;
|
|
84
|
+
base64?: string;
|
|
85
|
+
blob?: Blob;
|
|
86
|
+
}>;
|
|
87
|
+
setLayout(options: {
|
|
88
|
+
top: string;
|
|
89
|
+
left: string;
|
|
90
|
+
width: string;
|
|
91
|
+
height: string;
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
requestCameraPermission(): Promise<void>;
|
|
94
|
+
requestMicroPhonePermission(): Promise<void>;
|
|
95
|
+
isOpen(): Promise<{
|
|
96
|
+
isOpen: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
addListener(eventName: 'onPlayed', listenerFunc: onPlayedListener): Promise<PluginListenerHandle>;
|
|
99
|
+
addListener(eventName: 'onOrientationChanged', listenerFunc: onOrientationChangedListener): Promise<PluginListenerHandle>;
|
|
100
|
+
removeAllListeners(): Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
export declare type onPlayedListener = (result: {
|
|
103
|
+
resolution: string;
|
|
104
|
+
}) => void;
|
|
105
|
+
export declare type onOrientationChangedListener = () => void;
|
|
106
|
+
/**
|
|
107
|
+
* measuredByPercentage: 0 in pixel, 1 in percent
|
|
108
|
+
*/
|
|
109
|
+
export interface ScanRegion {
|
|
110
|
+
left: number;
|
|
111
|
+
top: number;
|
|
112
|
+
right: number;
|
|
113
|
+
bottom: number;
|
|
114
|
+
measuredByPercentage: number;
|
|
115
|
+
}
|
|
116
|
+
export declare enum EnumResolution {
|
|
117
|
+
RESOLUTION_AUTO = 0,
|
|
118
|
+
RESOLUTION_480P = 1,
|
|
119
|
+
RESOLUTION_720P = 2,
|
|
120
|
+
RESOLUTION_1080P = 3,
|
|
121
|
+
RESOLUTION_2K = 4,
|
|
122
|
+
RESOLUTION_4K = 5
|
|
123
|
+
}
|