capacitor-community-multilens-camerapreview 0.0.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.
Files changed (37) hide show
  1. package/CapacitorCommunityMultilensCamerapreview.podspec +17 -0
  2. package/README.md +210 -0
  3. package/android/build.gradle +55 -0
  4. package/android/src/main/AndroidManifest.xml +5 -0
  5. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +1005 -0
  6. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +547 -0
  7. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomSurfaceView.java +23 -0
  8. package/android/src/main/java/com/ahm/capacitor/camera/preview/CustomTextureView.java +29 -0
  9. package/android/src/main/java/com/ahm/capacitor/camera/preview/Preview.java +386 -0
  10. package/android/src/main/java/com/ahm/capacitor/camera/preview/TapGestureDetector.java +24 -0
  11. package/android/src/main/res/layout/bridge_layout_main.xml +15 -0
  12. package/android/src/main/res/layout/camera_activity.xml +68 -0
  13. package/android/src/main/res/values/camera_ids.xml +4 -0
  14. package/android/src/main/res/values/camera_theme.xml +9 -0
  15. package/android/src/main/res/values/colors.xml +3 -0
  16. package/android/src/main/res/values/strings.xml +3 -0
  17. package/android/src/main/res/values/styles.xml +3 -0
  18. package/dist/docs.json +390 -0
  19. package/dist/esm/definitions.d.ts +79 -0
  20. package/dist/esm/definitions.js +2 -0
  21. package/dist/esm/definitions.js.map +1 -0
  22. package/dist/esm/index.d.ts +4 -0
  23. package/dist/esm/index.js +7 -0
  24. package/dist/esm/index.js.map +1 -0
  25. package/dist/esm/web.d.ts +27 -0
  26. package/dist/esm/web.js +153 -0
  27. package/dist/esm/web.js.map +1 -0
  28. package/dist/plugin.cjs.js +164 -0
  29. package/dist/plugin.cjs.js.map +1 -0
  30. package/dist/plugin.js +167 -0
  31. package/dist/plugin.js.map +1 -0
  32. package/ios/Plugin/CameraController.swift +667 -0
  33. package/ios/Plugin/Info.plist +24 -0
  34. package/ios/Plugin/Plugin.h +10 -0
  35. package/ios/Plugin/Plugin.m +17 -0
  36. package/ios/Plugin/Plugin.swift +300 -0
  37. package/package.json +78 -0
@@ -0,0 +1,17 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'CapacitorCommunityMultilensCamerapreview'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+ s.homepage = package['repository']['url']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
+ s.ios.deployment_target = '13.0'
15
+ s.dependency 'Capacitor'
16
+ s.swift_version = '5.1'
17
+ end
package/README.md ADDED
@@ -0,0 +1,210 @@
1
+ # capacitor-community-multilens-camerapreview
2
+
3
+ fork of capacitor community camera preview with support for switchting lenses
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install capacitor-community-multilens-camerapreview
9
+ npx cap sync
10
+ ```
11
+
12
+ ## API
13
+
14
+ <docgen-index>
15
+
16
+ * [`start(...)`](#start)
17
+ * [`stop()`](#stop)
18
+ * [`capture(...)`](#capture)
19
+ * [`captureSample(...)`](#capturesample)
20
+ * [`getSupportedFlashModes()`](#getsupportedflashmodes)
21
+ * [`setFlashMode(...)`](#setflashmode)
22
+ * [`flip()`](#flip)
23
+ * [`setOpacity(...)`](#setopacity)
24
+ * [`getSupportedZoomLevels()`](#getsupportedzoomlevels)
25
+ * [Interfaces](#interfaces)
26
+ * [Type Aliases](#type-aliases)
27
+
28
+ </docgen-index>
29
+
30
+ <docgen-api>
31
+ <!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
32
+
33
+ ### start(...)
34
+
35
+ ```typescript
36
+ start(options: CameraPreviewOptions) => Promise<{}>
37
+ ```
38
+
39
+ | Param | Type |
40
+ | ------------- | --------------------------------------------------------------------- |
41
+ | **`options`** | <code><a href="#camerapreviewoptions">CameraPreviewOptions</a></code> |
42
+
43
+ **Returns:** <code>Promise&lt;{}&gt;</code>
44
+
45
+ --------------------
46
+
47
+
48
+ ### stop()
49
+
50
+ ```typescript
51
+ stop() => Promise<{}>
52
+ ```
53
+
54
+ **Returns:** <code>Promise&lt;{}&gt;</code>
55
+
56
+ --------------------
57
+
58
+
59
+ ### capture(...)
60
+
61
+ ```typescript
62
+ capture(options: CameraPreviewPictureOptions) => Promise<{ value: string; }>
63
+ ```
64
+
65
+ | Param | Type |
66
+ | ------------- | ----------------------------------------------------------------------------------- |
67
+ | **`options`** | <code><a href="#camerapreviewpictureoptions">CameraPreviewPictureOptions</a></code> |
68
+
69
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
70
+
71
+ --------------------
72
+
73
+
74
+ ### captureSample(...)
75
+
76
+ ```typescript
77
+ captureSample(options: CameraSampleOptions) => Promise<{ value: string; }>
78
+ ```
79
+
80
+ | Param | Type |
81
+ | ------------- | ------------------------------------------------------------------- |
82
+ | **`options`** | <code><a href="#camerasampleoptions">CameraSampleOptions</a></code> |
83
+
84
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
85
+
86
+ --------------------
87
+
88
+
89
+ ### getSupportedFlashModes()
90
+
91
+ ```typescript
92
+ getSupportedFlashModes() => Promise<{ result: CameraPreviewFlashMode[]; }>
93
+ ```
94
+
95
+ **Returns:** <code>Promise&lt;{ result: CameraPreviewFlashMode[]; }&gt;</code>
96
+
97
+ --------------------
98
+
99
+
100
+ ### setFlashMode(...)
101
+
102
+ ```typescript
103
+ setFlashMode(options: { flashMode: CameraPreviewFlashMode | string; }) => Promise<void>
104
+ ```
105
+
106
+ | Param | Type |
107
+ | ------------- | ----------------------------------- |
108
+ | **`options`** | <code>{ flashMode: string; }</code> |
109
+
110
+ --------------------
111
+
112
+
113
+ ### flip()
114
+
115
+ ```typescript
116
+ flip() => Promise<void>
117
+ ```
118
+
119
+ --------------------
120
+
121
+
122
+ ### setOpacity(...)
123
+
124
+ ```typescript
125
+ setOpacity(options: CameraOpacityOptions) => Promise<{}>
126
+ ```
127
+
128
+ | Param | Type |
129
+ | ------------- | --------------------------------------------------------------------- |
130
+ | **`options`** | <code><a href="#cameraopacityoptions">CameraOpacityOptions</a></code> |
131
+
132
+ **Returns:** <code>Promise&lt;{}&gt;</code>
133
+
134
+ --------------------
135
+
136
+
137
+ ### getSupportedZoomLevels()
138
+
139
+ ```typescript
140
+ getSupportedZoomLevels() => Promise<{ result: any[]; }>
141
+ ```
142
+
143
+ **Returns:** <code>Promise&lt;{ result: any[]; }&gt;</code>
144
+
145
+ --------------------
146
+
147
+
148
+ ### Interfaces
149
+
150
+
151
+ #### CameraPreviewOptions
152
+
153
+ | Prop | Type | Description |
154
+ | ---------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
155
+ | **`parent`** | <code>string</code> | Parent element to attach the video preview element to (applicable to the web platform only) |
156
+ | **`className`** | <code>string</code> | Class name to add to the video preview element (applicable to the web platform only) |
157
+ | **`width`** | <code>number</code> | The preview width in pixels, default window.screen.width |
158
+ | **`height`** | <code>number</code> | The preview height in pixels, default window.screen.height |
159
+ | **`x`** | <code>number</code> | The x origin, default 0 (applicable to the android and ios platforms only) |
160
+ | **`y`** | <code>number</code> | The y origin, default 0 (applicable to the android and ios platforms only) |
161
+ | **`toBack`** | <code>boolean</code> | Brings your html in front of your preview, default false (applicable to the android only) |
162
+ | **`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) |
163
+ | **`rotateWhenOrientationChanged`** | <code>boolean</code> | Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) |
164
+ | **`position`** | <code>string</code> | Choose the camera to use 'front' or 'rear', default 'front' |
165
+ | **`storeToFile`** | <code>boolean</code> | Defaults to false - Capture images to a file and return the file path instead of returning base64 encoded data |
166
+ | **`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) |
167
+ | **`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 * |
168
+ | **`disableAudio`** | <code>boolean</code> | Defaults to false - Web only - Disables audio stream to prevent permission requests and output switching |
169
+ | **`lockAndroidOrientation`** | <code>boolean</code> | Android Only - Locks device orientation when camera is showing. |
170
+ | **`enableOpacity`** | <code>boolean</code> | Defaults to false - Android and Web only. Set if camera preview can change opacity. |
171
+ | **`enableZoom`** | <code>boolean</code> | Defaults to false - Android only. Set if camera preview will support pinch to zoom. |
172
+ | **`zoomFactor`** | <code>any</code> | override defualt lens choice ios String 'ultra','wide','tele' android int example 100, 200 etc |
173
+
174
+
175
+ #### CameraPreviewPictureOptions
176
+
177
+ | Prop | Type | Description |
178
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
179
+ | **`height`** | <code>number</code> | The picture height, optional, default 0 (Device default) |
180
+ | **`width`** | <code>number</code> | The picture width, optional, default 0 (Device default) |
181
+ | **`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 |
182
+
183
+
184
+ #### CameraSampleOptions
185
+
186
+ | Prop | Type | Description |
187
+ | ------------- | ------------------- | ---------------------------------------- |
188
+ | **`quality`** | <code>number</code> | The picture quality, 0 - 100, default 85 |
189
+
190
+
191
+ #### CameraOpacityOptions
192
+
193
+ | Prop | Type | Description |
194
+ | ------------- | ------------------- | ----------------------------------------------------- |
195
+ | **`opacity`** | <code>number</code> | The percent opacity to set for camera view, default 1 |
196
+
197
+
198
+ ### Type Aliases
199
+
200
+
201
+ #### CameraPosition
202
+
203
+ <code>'rear' | 'front'</code>
204
+
205
+
206
+ #### CameraPreviewFlashMode
207
+
208
+ <code>'off' | 'on' | 'auto' | 'red-eye' | 'torch'</code>
209
+
210
+ </docgen-api>
@@ -0,0 +1,55 @@
1
+ ext {
2
+ junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3
+ androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
4
+ androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
5
+ androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
6
+ }
7
+
8
+ buildscript {
9
+ repositories {
10
+ mavenCentral()
11
+ google()
12
+ }
13
+ dependencies {
14
+ classpath 'com.android.tools.build:gradle:7.2.1'
15
+ }
16
+ }
17
+
18
+ apply plugin: 'com.android.library'
19
+
20
+ android {
21
+ compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
22
+ defaultConfig {
23
+ minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
24
+ targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
25
+ versionCode 1
26
+ versionName "1.0"
27
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
28
+ }
29
+ buildTypes {
30
+ release {
31
+ minifyEnabled false
32
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
33
+ }
34
+ }
35
+ lintOptions {
36
+ abortOnError false
37
+ }
38
+ }
39
+
40
+ repositories {
41
+ google()
42
+ mavenCentral()
43
+ }
44
+
45
+
46
+ dependencies {
47
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
48
+ implementation project(':capacitor-android')
49
+ implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
50
+ implementation 'androidx.exifinterface:exifinterface:1.3.2'
51
+ testImplementation "junit:junit:$junitVersion"
52
+ androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
53
+ androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
54
+ }
55
+
@@ -0,0 +1,5 @@
1
+
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="com.ahm.capacitor.camera.preview.capacitorcamerapreview">
4
+ </manifest>
5
+