@capgo/camera-preview 3.2.7 → 3.3.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/CapgoCameraPreview.podspec +1 -1
- package/README.md +235 -48
- package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4.2/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.4.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +8 -8
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -3
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +5 -7
- package/dist/docs.json +373 -0
- package/dist/esm/definitions.d.ts +3 -3
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +64 -65
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +148 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +151 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/CameraController.swift +1 -1
- package/ios/Plugin/Plugin.swift +5 -5
- package/ios/Plugin.xcodeproj/project.pbxproj +8 -2
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +4 -4
- package/package.json +40 -35
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
s.author = 'Ariel Hernandez Musa'
|
|
9
9
|
s.source = { :git => 'https://github.com/Cap-go/camera-preview.git', :tag => s.version.to_s }
|
|
10
10
|
s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
11
|
-
s.ios.deployment_target = '
|
|
11
|
+
s.ios.deployment_target = '13.0'
|
|
12
12
|
s.dependency 'Capacitor'
|
|
13
13
|
s.swift_version = '5.1'
|
|
14
14
|
end
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<h3 align="center">Capacitor Camera Preview</h3>
|
|
3
3
|
<p align="center"><strong><code>@capgo/camera-preview</code></strong></p>
|
|
4
4
|
<br>
|
|
5
|
-
<p align="center"><strong>CAPACITOR
|
|
5
|
+
<p align="center"><strong>CAPACITOR 4</strong></p><br>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
8
|
Capacitor plugin that allows camera interaction from Javascript and HTML<br>(based on cordova-plugin-camera-preview).
|
|
@@ -39,26 +39,31 @@ or
|
|
|
39
39
|
|
|
40
40
|
npm install @capgo/camera-preview
|
|
41
41
|
```
|
|
42
|
+
|
|
42
43
|
Then run
|
|
44
|
+
|
|
43
45
|
```
|
|
44
46
|
npx cap sync
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
## Extra Android installation steps
|
|
48
|
-
**Important** `camera-preview` 3+ requires Gradle 7. If you are using Gradle 4, please use [version 2](https://github.com/capacitor-community/camera-preview/tree/v2.1.0) of this plugin.
|
|
49
50
|
|
|
51
|
+
**Important** `camera-preview` 3+ requires Gradle 7.
|
|
50
52
|
Open `android/app/src/main/AndroidManifest.xml` and above the closing `</manifest>` tag add this line to request the CAMERA permission:
|
|
53
|
+
|
|
51
54
|
```xml
|
|
52
55
|
<uses-permission android:name="android.permission.CAMERA" />
|
|
53
56
|
```
|
|
57
|
+
|
|
54
58
|
For more help consult the [Capacitor docs](https://capacitorjs.com/docs/android/configuration#configuring-androidmanifestxml).
|
|
55
59
|
|
|
56
60
|
## Extra iOS installation steps
|
|
61
|
+
|
|
57
62
|
You will need to add two permissions to `Info.plist`. Follow the [Capacitor docs](https://capacitorjs.com/docs/ios/configuration#configuring-infoplist) and add permissions with the raw keys `NSCameraUsageDescription` and `NSMicrophoneUsageDescription`. `NSMicrophoneUsageDescription` is only required, if audio will be used. Otherwise set the `disableAudio` option to `true`, which also disables the microphone permission request.
|
|
58
63
|
|
|
59
64
|
## Extra Web installation steps
|
|
60
|
-
Add `import '@capgo/camera-preview'` to you entry script in ionic on `app.module.ts`, so capacitor can register the web platform from the plugin
|
|
61
65
|
|
|
66
|
+
Add `import '@capgo/camera-preview'` to you entry script in ionic on `app.module.ts`, so capacitor can register the web platform from the plugin
|
|
62
67
|
|
|
63
68
|
# Methods
|
|
64
69
|
|
|
@@ -67,23 +72,23 @@ Add `import '@capgo/camera-preview'` to you entry script in ionic on `app.module
|
|
|
67
72
|
Starts the camera preview instance.
|
|
68
73
|
<br>
|
|
69
74
|
|
|
70
|
-
| Option
|
|
71
|
-
|
|
72
|
-
| position
|
|
73
|
-
| width
|
|
74
|
-
| height
|
|
75
|
-
| x
|
|
76
|
-
| y
|
|
77
|
-
| toBack
|
|
78
|
-
| paddingBottom
|
|
79
|
-
| rotateWhenOrientationChanged | boolean
|
|
80
|
-
| storeToFile
|
|
81
|
-
| disableExifHeaderStripping
|
|
82
|
-
| enableHighResolution
|
|
83
|
-
| disableAudio
|
|
84
|
-
| lockAndroidOrientation
|
|
85
|
-
| enableOpacity
|
|
86
|
-
| enableZoom
|
|
75
|
+
| Option | values | descriptions |
|
|
76
|
+
| ---------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
77
|
+
| position | front \| rear | Show front or rear camera when start the preview. Defaults to front |
|
|
78
|
+
| width | number | (optional) The preview width in pixels, default window.screen.width (applicable to the android and ios platforms only) |
|
|
79
|
+
| height | number | (optional) The preview height in pixels, default window.screen.height (applicable to the android and ios platforms only) |
|
|
80
|
+
| x | number | (optional) The x origin, default 0 (applicable to the android and ios platforms only) |
|
|
81
|
+
| y | number | (optional) The y origin, default 0 (applicable to the android and ios platforms only) |
|
|
82
|
+
| toBack | boolean | (optional) Brings your html in front of your preview, default false (applicable to the android and ios platforms only) |
|
|
83
|
+
| paddingBottom | number | (optional) The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only) |
|
|
84
|
+
| rotateWhenOrientationChanged | boolean | (optional) Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) |
|
|
85
|
+
| storeToFile | boolean | (optional) Capture images to a file and return back the file path instead of returning base64 encoded data, default false. |
|
|
86
|
+
| disableExifHeaderStripping | boolean | (optional) Disable automatic rotation of the image, and let the browser deal with it, default true (applicable to the android and ios platforms only) |
|
|
87
|
+
| enableHighResolution | boolean | (optional) Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device |
|
|
88
|
+
| disableAudio | boolean | (optional) Disables audio stream to prevent permission requests, default false. (applicable to web and iOS only) |
|
|
89
|
+
| lockAndroidOrientation | boolean | (optional) Locks device orientation when camera is showing, default false. (applicable to Android only) |
|
|
90
|
+
| enableOpacity | boolean | (optional) Make the camera preview see-through. Ideal for augmented reality uses. Default false (applicable to Android and web only) |
|
|
91
|
+
| enableZoom | boolean | (optional) Set if you can pinch to zoom. Default false (applicable to the android and ios platforms only) |
|
|
87
92
|
|
|
88
93
|
<!-- <strong>Options:</strong>
|
|
89
94
|
All options stated are optional and will default to values here
|
|
@@ -106,7 +111,7 @@ import { CameraPreview, CameraPreviewOptions } from '@capgo/camera-preview';
|
|
|
106
111
|
const cameraPreviewOptions: CameraPreviewOptions = {
|
|
107
112
|
position: 'rear',
|
|
108
113
|
height: 1920,
|
|
109
|
-
width: 1080
|
|
114
|
+
width: 1080,
|
|
110
115
|
};
|
|
111
116
|
CameraPreview.start(cameraPreviewOptions);
|
|
112
117
|
```
|
|
@@ -128,7 +133,8 @@ Take into account that this will make transparent all ion-content on application
|
|
|
128
133
|
```
|
|
129
134
|
|
|
130
135
|
If the camera preview is not displaying after applying the above styles, apply transparent background color to the root div element of the parent component
|
|
131
|
-
Ex: VueJS >> App.vue component
|
|
136
|
+
Ex: VueJS >> App.vue component
|
|
137
|
+
|
|
132
138
|
```html
|
|
133
139
|
<template>
|
|
134
140
|
<ion-app id="app">
|
|
@@ -143,7 +149,6 @@ Ex: VueJS >> App.vue component
|
|
|
143
149
|
<style>
|
|
144
150
|
```
|
|
145
151
|
|
|
146
|
-
|
|
147
152
|
### stop()
|
|
148
153
|
|
|
149
154
|
<info>Stops the camera preview instance.</info><br/>
|
|
@@ -153,9 +158,11 @@ CameraPreview.stop();
|
|
|
153
158
|
```
|
|
154
159
|
|
|
155
160
|
### flip()
|
|
161
|
+
|
|
156
162
|
<info>Switch between rear and front camera only for android and ios, web is not supported</info>
|
|
163
|
+
|
|
157
164
|
```javascript
|
|
158
|
-
CameraPreview.flip()
|
|
165
|
+
CameraPreview.flip();
|
|
159
166
|
```
|
|
160
167
|
|
|
161
168
|
<!-- ### switchCamera([successCallback, errorCallback])
|
|
@@ -184,11 +191,11 @@ CameraPreview.hide();
|
|
|
184
191
|
|
|
185
192
|
### capture(options)
|
|
186
193
|
|
|
187
|
-
| Option
|
|
188
|
-
|
|
189
|
-
| quality
|
|
190
|
-
| width
|
|
191
|
-
| height
|
|
194
|
+
| Option | values | descriptions |
|
|
195
|
+
| ------- | ------ | --------------------------------------------------------- |
|
|
196
|
+
| quality | number | (optional) The picture quality, 0 - 100, default 85 |
|
|
197
|
+
| width | number | (optional) The picture width, default 0 (Device default) |
|
|
198
|
+
| height | number | (optional) The picture height, default 0 (Device default) |
|
|
192
199
|
|
|
193
200
|
<!-- <info>Take the picture. If width and height are not specified or are 0 it will use the defaults. If width and height are specified, it will choose a supported photo size that is closest to width and height specified and has closest aspect ratio to the preview. The argument `quality` defaults to `85` and specifies the quality/compression value: `0=max compression`, `100=max quality`.</info><br/> -->
|
|
194
201
|
|
|
@@ -196,21 +203,20 @@ CameraPreview.hide();
|
|
|
196
203
|
import { CameraPreviewPictureOptions } from '@capgo/camera-preview';
|
|
197
204
|
|
|
198
205
|
const cameraPreviewPictureOptions: CameraPreviewPictureOptions = {
|
|
199
|
-
quality: 50
|
|
206
|
+
quality: 50,
|
|
200
207
|
};
|
|
201
208
|
|
|
202
209
|
const result = await CameraPreview.capture(cameraPreviewPictureOptions);
|
|
203
210
|
const base64PictureData = result.value;
|
|
204
211
|
|
|
205
212
|
// do sometime with base64PictureData
|
|
206
|
-
|
|
207
213
|
```
|
|
208
214
|
|
|
209
215
|
### captureSample(options)
|
|
210
216
|
|
|
211
|
-
| Option
|
|
212
|
-
|
|
213
|
-
| quality
|
|
217
|
+
| Option | values | descriptions |
|
|
218
|
+
| ------- | ------ | --------------------------------------------------- |
|
|
219
|
+
| quality | number | (optional) The picture quality, 0 - 100, default 85 |
|
|
214
220
|
|
|
215
221
|
<info>Captures a sample image from the video stream. Only for Android and iOS, web implementation falls back to `capture` method. This can be used to perform real-time analysis on the current frame in the video. The argument `quality` defaults to `85` and specifies the quality/compression value: `0=max compression`, `100=max quality`.</info><br/>
|
|
216
222
|
|
|
@@ -218,14 +224,13 @@ const base64PictureData = result.value;
|
|
|
218
224
|
import { CameraSampleOptions } from '@capgo/camera-preview';
|
|
219
225
|
|
|
220
226
|
const cameraSampleOptions: CameraSampleOptions = {
|
|
221
|
-
quality: 50
|
|
227
|
+
quality: 50,
|
|
222
228
|
};
|
|
223
229
|
|
|
224
230
|
const result = await CameraPreview.captureSample(cameraSampleOptions);
|
|
225
231
|
const base64PictureData = result.value;
|
|
226
232
|
|
|
227
233
|
// do something with base64PictureData
|
|
228
|
-
|
|
229
234
|
```
|
|
230
235
|
|
|
231
236
|
### getSupportedFlashModes()
|
|
@@ -238,6 +243,7 @@ import { CameraPreviewFlashMode } from '@capgo/camera-preview';
|
|
|
238
243
|
const flashModes = await CameraPreview.getSupportedFlashModes();
|
|
239
244
|
const supportedFlashModes: CameraPreviewFlashMode[] = flashModes.result;
|
|
240
245
|
```
|
|
246
|
+
|
|
241
247
|
### setFlashMode(options)
|
|
242
248
|
|
|
243
249
|
<info>Set the flash mode. See <code>[FLASH_MODE](#camera_Settings.FlashMode)</code> for details about the possible values for flashMode.</info><br/>
|
|
@@ -248,7 +254,7 @@ const CameraPreviewFlashMode: CameraPreviewFlashMode = 'torch';
|
|
|
248
254
|
CameraPreview.setFlashMode(cameraPreviewFlashMode);
|
|
249
255
|
```
|
|
250
256
|
|
|
251
|
-
### startRecordVideo(options)
|
|
257
|
+
### startRecordVideo(options) ---- ANDROID only
|
|
252
258
|
|
|
253
259
|
<info>Start capturing video</info><br/>
|
|
254
260
|
|
|
@@ -262,7 +268,7 @@ const cameraPreviewOptions: CameraPreviewOptions = {
|
|
|
262
268
|
CameraPreview.startRecordVideo(cameraPreviewOptions);
|
|
263
269
|
```
|
|
264
270
|
|
|
265
|
-
### stopRecordVideo()
|
|
271
|
+
### stopRecordVideo() ---- ANDROID only
|
|
266
272
|
|
|
267
273
|
<info>Finish capturing a video. The captured video will be returned as a file path and the video format is .mp4</info><br/>
|
|
268
274
|
|
|
@@ -271,13 +277,13 @@ const resultRecordVideo = await CameraPreview.stopRecordVideo();
|
|
|
271
277
|
this.stopCamera();
|
|
272
278
|
```
|
|
273
279
|
|
|
274
|
-
### setOpacity(options: CameraOpacityOptions): Promise<{}>;
|
|
280
|
+
### setOpacity(options: CameraOpacityOptions): Promise<{}>; ---- ANDROID only
|
|
275
281
|
|
|
276
282
|
<info>Set the opacity for the camera preview</info><br/>
|
|
277
283
|
|
|
278
284
|
```javascript
|
|
279
|
-
const myCamera = CameraPreview.start({enableOpacity: true});
|
|
280
|
-
myCamera.setOpacity({opacity: 0.4});
|
|
285
|
+
const myCamera = CameraPreview.start({ enableOpacity: true });
|
|
286
|
+
myCamera.setOpacity({ opacity: 0.4 });
|
|
281
287
|
```
|
|
282
288
|
|
|
283
289
|
# Settings
|
|
@@ -288,13 +294,13 @@ myCamera.setOpacity({opacity: 0.4});
|
|
|
288
294
|
|
|
289
295
|
<info>Flash mode settings:</info><br/>
|
|
290
296
|
|
|
291
|
-
| Name | Type
|
|
292
|
-
| ------- |
|
|
293
|
-
| OFF | string
|
|
294
|
-
| ON | string
|
|
295
|
-
| AUTO | string
|
|
296
|
-
| RED_EYE | string
|
|
297
|
-
| TORCH | string
|
|
297
|
+
| Name | Type | Default | Note |
|
|
298
|
+
| ------- | ------ | ------- | ------------ |
|
|
299
|
+
| OFF | string | off | |
|
|
300
|
+
| ON | string | on | |
|
|
301
|
+
| AUTO | string | auto | |
|
|
302
|
+
| RED_EYE | string | red-eye | Android Only |
|
|
303
|
+
| TORCH | string | torch | |
|
|
298
304
|
|
|
299
305
|
<!--
|
|
300
306
|
|
|
@@ -429,3 +435,184 @@ Created by Marcel Barbosa Pinto [@mbppower](https://github.com/mbppower)
|
|
|
429
435
|
A working example can be found at [Demo](https://github.com/capacitor-community/camera-preview/tree/master/demo)
|
|
430
436
|
|
|
431
437
|
To run the demo on your local network and access media devices, a secure context is needed. Add an `.env` file at the root of the demo folder with `HTTPS=true` to start react with HTTPS.
|
|
438
|
+
|
|
439
|
+
## API
|
|
440
|
+
|
|
441
|
+
<docgen-index>
|
|
442
|
+
|
|
443
|
+
* [`start(...)`](#start)
|
|
444
|
+
* [`stop()`](#stop)
|
|
445
|
+
* [`capture(...)`](#capture)
|
|
446
|
+
* [`captureSample(...)`](#capturesample)
|
|
447
|
+
* [`getSupportedFlashModes()`](#getsupportedflashmodes)
|
|
448
|
+
* [`setFlashMode(...)`](#setflashmode)
|
|
449
|
+
* [`flip()`](#flip)
|
|
450
|
+
* [`setOpacity(...)`](#setopacity)
|
|
451
|
+
* [Interfaces](#interfaces)
|
|
452
|
+
* [Type Aliases](#type-aliases)
|
|
453
|
+
|
|
454
|
+
</docgen-index>
|
|
455
|
+
|
|
456
|
+
<docgen-api>
|
|
457
|
+
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
458
|
+
|
|
459
|
+
### start(...)
|
|
460
|
+
|
|
461
|
+
```typescript
|
|
462
|
+
start(options: CameraPreviewOptions) => Promise<void>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
| Param | Type |
|
|
466
|
+
| ------------- | --------------------------------------------------------------------- |
|
|
467
|
+
| **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> |
|
|
468
|
+
|
|
469
|
+
--------------------
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
### stop()
|
|
473
|
+
|
|
474
|
+
```typescript
|
|
475
|
+
stop() => Promise<void>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
--------------------
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
### capture(...)
|
|
482
|
+
|
|
483
|
+
```typescript
|
|
484
|
+
capture(options: CameraPreviewPictureOptions) => Promise<{ value: string; }>
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
| Param | Type |
|
|
488
|
+
| ------------- | ----------------------------------------------------------------------------------- |
|
|
489
|
+
| **`options`** | <code><a href="#camerapreviewpictureoptions">CameraPreviewPictureOptions</a></code> |
|
|
490
|
+
|
|
491
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
492
|
+
|
|
493
|
+
--------------------
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
### captureSample(...)
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
captureSample(options: CameraSampleOptions) => Promise<{ value: string; }>
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
| Param | Type |
|
|
503
|
+
| ------------- | ------------------------------------------------------------------- |
|
|
504
|
+
| **`options`** | <code><a href="#camerasampleoptions">CameraSampleOptions</a></code> |
|
|
505
|
+
|
|
506
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
507
|
+
|
|
508
|
+
--------------------
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
### getSupportedFlashModes()
|
|
512
|
+
|
|
513
|
+
```typescript
|
|
514
|
+
getSupportedFlashModes() => Promise<{ result: CameraPreviewFlashMode[]; }>
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
**Returns:** <code>Promise<{ result: CameraPreviewFlashMode[]; }></code>
|
|
518
|
+
|
|
519
|
+
--------------------
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
### setFlashMode(...)
|
|
523
|
+
|
|
524
|
+
```typescript
|
|
525
|
+
setFlashMode(options: { flashMode: CameraPreviewFlashMode | string; }) => Promise<void>
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
| Param | Type |
|
|
529
|
+
| ------------- | ----------------------------------- |
|
|
530
|
+
| **`options`** | <code>{ flashMode: string; }</code> |
|
|
531
|
+
|
|
532
|
+
--------------------
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
### flip()
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
flip() => Promise<void>
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
--------------------
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
### setOpacity(...)
|
|
545
|
+
|
|
546
|
+
```typescript
|
|
547
|
+
setOpacity(options: CameraOpacityOptions) => Promise<void>
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
| Param | Type |
|
|
551
|
+
| ------------- | --------------------------------------------------------------------- |
|
|
552
|
+
| **`options`** | <code><a href="#cameraopacityoptions">CameraOpacityOptions</a></code> |
|
|
553
|
+
|
|
554
|
+
--------------------
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
### Interfaces
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
#### CameraPreviewOptions
|
|
561
|
+
|
|
562
|
+
| Prop | Type | Description |
|
|
563
|
+
| ---------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
564
|
+
| **`parent`** | <code>string</code> | Parent element to attach the video preview element to (applicable to the web platform only) |
|
|
565
|
+
| **`className`** | <code>string</code> | Class name to add to the video preview element (applicable to the web platform only) |
|
|
566
|
+
| **`width`** | <code>number</code> | The preview width in pixels, default window.screen.width |
|
|
567
|
+
| **`height`** | <code>number</code> | The preview height in pixels, default window.screen.height |
|
|
568
|
+
| **`x`** | <code>number</code> | The x origin, default 0 (applicable to the android and ios platforms only) |
|
|
569
|
+
| **`y`** | <code>number</code> | The y origin, default 0 (applicable to the android and ios platforms only) |
|
|
570
|
+
| **`toBack`** | <code>boolean</code> | Brings your html in front of your preview, default false (applicable to the android only) |
|
|
571
|
+
| **`paddingBottom`** | <code>number</code> | The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only) |
|
|
572
|
+
| **`rotateWhenOrientationChanged`** | <code>boolean</code> | Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) |
|
|
573
|
+
| **`position`** | <code>string</code> | Choose the camera to use 'front' or 'rear', default 'front' |
|
|
574
|
+
| **`storeToFile`** | <code>boolean</code> | Defaults to false - Capture images to a file and return the file path instead of returning base64 encoded data |
|
|
575
|
+
| **`disableExifHeaderStripping`** | <code>boolean</code> | Defaults to false - Android Only - Disable automatic rotation of the image, and let the browser deal with it (keep reading on how to achieve it) |
|
|
576
|
+
| **`enableHighResolution`** | <code>boolean</code> | Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device * |
|
|
577
|
+
| **`disableAudio`** | <code>boolean</code> | Defaults to false - Web only - Disables audio stream to prevent permission requests and output switching |
|
|
578
|
+
| **`lockAndroidOrientation`** | <code>boolean</code> | Android Only - Locks device orientation when camera is showing. |
|
|
579
|
+
| **`enableOpacity`** | <code>boolean</code> | Defaults to false - Android and Web only. Set if camera preview can change opacity. |
|
|
580
|
+
| **`enableZoom`** | <code>boolean</code> | Defaults to false - Android only. Set if camera preview will support pinch to zoom. |
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
#### CameraPreviewPictureOptions
|
|
584
|
+
|
|
585
|
+
| Prop | Type | Description |
|
|
586
|
+
| ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
587
|
+
| **`height`** | <code>number</code> | The picture height, optional, default 0 (Device default) |
|
|
588
|
+
| **`width`** | <code>number</code> | The picture width, optional, default 0 (Device default) |
|
|
589
|
+
| **`quality`** | <code>number</code> | The picture quality, 0 - 100, default 85 on `iOS/Android`. If left undefined, the `web` implementation will export a PNG, otherwise a JPEG will be generated |
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
#### CameraSampleOptions
|
|
593
|
+
|
|
594
|
+
| Prop | Type | Description |
|
|
595
|
+
| ------------- | ------------------- | ---------------------------------------- |
|
|
596
|
+
| **`quality`** | <code>number</code> | The picture quality, 0 - 100, default 85 |
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
#### CameraOpacityOptions
|
|
600
|
+
|
|
601
|
+
| Prop | Type | Description |
|
|
602
|
+
| ------------- | ------------------- | ----------------------------------------------------- |
|
|
603
|
+
| **`opacity`** | <code>number</code> | The percent opacity to set for camera view, default 1 |
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
### Type Aliases
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
#### CameraPosition
|
|
610
|
+
|
|
611
|
+
<code>'rear' | 'front'</code>
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
#### CameraPreviewFlashMode
|
|
615
|
+
|
|
616
|
+
<code>'off' | 'on' | 'auto' | 'red-eye' | 'torch'</code>
|
|
617
|
+
|
|
618
|
+
</docgen-api>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
File without changes
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
ext {
|
|
2
|
-
junitVersion =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
4
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
5
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
@@ -11,17 +11,17 @@ buildscript {
|
|
|
11
11
|
google()
|
|
12
12
|
}
|
|
13
13
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:
|
|
14
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
apply plugin: 'com.android.library'
|
|
19
19
|
|
|
20
20
|
android {
|
|
21
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
21
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
22
22
|
defaultConfig {
|
|
23
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
24
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
23
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
24
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
|
|
25
25
|
versionCode 1
|
|
26
26
|
versionName "1.0"
|
|
27
27
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
#Fri Dec 01 12:41:00 CST 2017
|
|
2
1
|
distributionBase=GRADLE_USER_HOME
|
|
3
2
|
distributionPath=wrapper/dists
|
|
3
|
+
distributionUrl=https://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
|
-
zipStorePath=wrapper/dists
|
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
|
5
|
+
zipStorePath=wrapper/dists
|
|
@@ -396,15 +396,16 @@ public class CameraActivity extends Fragment {
|
|
|
396
396
|
super.onConfigurationChanged(newConfig);
|
|
397
397
|
|
|
398
398
|
final FrameLayout frameContainerLayout = (FrameLayout) view.findViewById(
|
|
399
|
-
|
|
399
|
+
getResources().getIdentifier("frame_container", "id", appResourcesPackage)
|
|
400
400
|
);
|
|
401
401
|
|
|
402
|
-
final int previousOrientation = frameContainerLayout.getHeight() > frameContainerLayout.getWidth()
|
|
402
|
+
final int previousOrientation = frameContainerLayout.getHeight() > frameContainerLayout.getWidth()
|
|
403
|
+
? Configuration.ORIENTATION_PORTRAIT
|
|
404
|
+
: Configuration.ORIENTATION_LANDSCAPE;
|
|
403
405
|
// Checks if the orientation of the screen has changed
|
|
404
406
|
if (newConfig.orientation != previousOrientation) {
|
|
405
|
-
|
|
406
407
|
final RelativeLayout frameCamContainerLayout = (RelativeLayout) view.findViewById(
|
|
407
|
-
|
|
408
|
+
getResources().getIdentifier("frame_camera_cont", "id", appResourcesPackage)
|
|
408
409
|
);
|
|
409
410
|
|
|
410
411
|
frameContainerLayout.getLayoutParams().width = frameCamContainerLayout.getHeight();
|
|
@@ -419,12 +420,9 @@ public class CameraActivity extends Fragment {
|
|
|
419
420
|
frameCamContainerLayout.forceLayout();
|
|
420
421
|
|
|
421
422
|
mPreview.setCameraDisplayOrientation();
|
|
422
|
-
|
|
423
423
|
}
|
|
424
|
-
|
|
425
424
|
}
|
|
426
425
|
|
|
427
|
-
|
|
428
426
|
public Camera getCamera() {
|
|
429
427
|
return mCamera;
|
|
430
428
|
}
|