@capacitor-community/camera-preview 4.0.0 → 5.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 +19 -13
- package/android/.gradle/8.0.2/checksums/checksums.lock +0 -0
- package/android/.gradle/{4.10.1/fileHashes/fileHashes.bin → 8.0.2/checksums/md5-checksums.bin} +0 -0
- package/android/.gradle/8.0.2/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.0.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.0.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/8.0.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.0.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/8.0.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.0.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/8.0.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/build.gradle +10 -8
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/android/gradle.properties +1 -1
- package/android/gradlew +14 -4
- package/android/gradlew.bat +34 -32
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +3 -3
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +5 -7
- package/dist/esm/definitions.d.ts +4 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +3 -3
- package/dist/esm/web.js +14 -10
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +155 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +158 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Plugin/CameraController.swift +1 -1
- package/ios/Plugin/Plugin.swift +5 -5
- package/ios/Podfile +7 -4
- package/ios/Podfile.lock +9 -10
- package/ios/Pods/CapacitorCordova/LICENSE +23 -0
- package/ios/Pods/CapacitorCordova/README.md +39 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/CapacitorCordova.h +21 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.h +8 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/AppDelegate.m +5 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDV.h +28 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVAvailability.h +109 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegate.h +51 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.h +39 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVCommandDelegateImpl.m +154 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.h +31 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVConfigParser.m +81 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.h +52 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVInvokedUrlCommand.m +116 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.h +81 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPlugin.m +154 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.h +25 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginManager.m +77 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.h +82 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVPluginResult.m +216 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.h +41 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUIWebViewDelegate.m +399 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.h +27 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVURLProtocol.m +74 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.h +27 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVUserAgentUtil.m +156 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.h +30 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/CDVViewController.m +34 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
- package/ios/Pods/CapacitorCordova/ios/CapacitorCordova/CapacitorCordova/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
- package/ios/Pods/Local Podspecs/Capacitor.podspec.json +34 -0
- package/ios/Pods/Local Podspecs/CapacitorCordova.podspec.json +26 -0
- package/ios/Pods/Manifest.lock +22 -0
- package/ios/Pods/Pods.xcodeproj/project.pbxproj +1374 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Capacitor.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/CapacitorCordova.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Pods-Plugin.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/Pods-PluginTests.xcscheme +58 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/julionic.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor-prefix.pch +12 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.debug.xcconfig +15 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.modulemap +8 -0
- package/ios/Pods/Target Support Files/Capacitor/Capacitor.release.xcconfig +15 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-Info.plist +26 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-dummy.m +5 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-prefix.pch +12 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova-umbrella.h +32 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.debug.xcconfig +12 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.modulemap +6 -0
- package/ios/Pods/Target Support Files/CapacitorCordova/CapacitorCordova.release.xcconfig +12 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.markdown +53 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-acknowledgements.plist +91 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin-umbrella.h +16 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig +14 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.modulemap +6 -0
- package/ios/Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig +14 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-Info.plist +26 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.markdown +53 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-acknowledgements.plist +91 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-dummy.m +5 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh +188 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests-umbrella.h +16 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig +15 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.modulemap +6 -0
- package/ios/Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig +15 -0
- package/package.json +19 -9
- package/android/.gradle/4.10.1/fileHashes/fileHashes.lock +0 -0
- package/android/.idea/compiler.xml +0 -6
- package/android/.idea/gradle.xml +0 -20
- package/android/.idea/jarRepositories.xml +0 -45
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_3_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_2_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_3_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_2_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_core_core_1_3_2_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_core_core_1_5_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_exifinterface_exifinterface_1_3_2_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_0_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_4_aar.xml +0 -14
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_0.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_1.xml +0 -9
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_core_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_core_3_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_espresso_espresso_idling_resource_3_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_ext_junit_1_1_2_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_monitor_1_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_monitor_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_runner_1_1_0_alpha3_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_test_runner_1_3_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_tracing_tracing_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1.xml +0 -9
- package/android/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1.xml +0 -9
- package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +0 -9
- package/android/.idea/libraries/Gradle__junit_junit_4_12.xml +0 -9
- package/android/.idea/libraries/Gradle__junit_junit_4_13_1.xml +0 -9
- package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_1_10_18.xml +0 -9
- package/android/.idea/libraries/Gradle__net_bytebuddy_byte_buddy_agent_1_10_18.xml +0 -9
- package/android/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0.xml +0 -9
- package/android/.idea/libraries/Gradle__org_apache_cordova_framework_7_0_0_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3.xml +0 -9
- package/android/.idea/libraries/Gradle__org_json_json_20140107.xml +0 -9
- package/android/.idea/libraries/Gradle__org_mockito_mockito_core_3_6_28.xml +0 -9
- package/android/.idea/libraries/Gradle__org_mockito_mockito_inline_3_6_28.xml +0 -9
- package/android/.idea/libraries/Gradle__org_objenesis_objenesis_3_1.xml +0 -9
- package/android/.idea/misc.xml +0 -9
- package/android/.idea/modules/1419750366/android.capacitor-android.iml +0 -92
- package/android/.idea/modules/android.iml +0 -87
- package/android/.idea/modules.xml +0 -9
- package/android/.idea/vcs.xml +0 -6
- /package/android/.gradle/{4.10.1 → 8.0.2/dependencies-accessors}/gc.properties +0 -0
- /package/android/.gradle/{4.10.1 → 8.0.2}/fileChanges/last-build.bin +0 -0
package/README.md
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
<h3 align="center">Capacitor Camera Preview</h3>
|
|
3
3
|
<p align="center"><strong><code>@capacitor-community/camera-preview</code></strong></p>
|
|
4
4
|
<br>
|
|
5
|
-
<p align="center"><strong>CAPACITOR
|
|
5
|
+
<p align="center"><strong>CAPACITOR 5</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).
|
|
9
9
|
</p>
|
|
10
10
|
<br>
|
|
11
|
-
Version
|
|
12
|
-
|
|
11
|
+
Version 5 of this plugin requires Capacitor 5.
|
|
12
|
+
|
|
13
|
+
If you are using Capacitor 4, use [version 4](https://github.com/capacitor-community/camera-preview/releases/tag/v4.0.0)
|
|
14
|
+
|
|
15
|
+
If you are using Capacitor 3, use [version 3](https://github.com/capacitor-community/camera-preview/releases/tag/v3.1.2)
|
|
16
|
+
|
|
17
|
+
If you are using Capacitor 2, use [version 1](https://github.com/capacitor-community/camera-preview/releases/tag/v1.2.1)
|
|
13
18
|
|
|
14
19
|
**PR's are greatly appreciated.**
|
|
15
20
|
|
|
@@ -53,20 +58,22 @@ Open `android/app/src/main/AndroidManifest.xml` and above the closing `</manifes
|
|
|
53
58
|
```
|
|
54
59
|
For more help consult the [Capacitor docs](https://capacitorjs.com/docs/android/configuration#configuring-androidmanifestxml).
|
|
55
60
|
|
|
61
|
+
### Variables
|
|
62
|
+
|
|
63
|
+
This plugin will use the following project variables (defined in your app's `variables.gradle` file):
|
|
64
|
+
|
|
65
|
+
- `androidxExifInterfaceVersion`: version of `androidx.exifinterface:exifinterface` (default: `1.3.6`)
|
|
66
|
+
|
|
56
67
|
## Extra iOS installation steps
|
|
57
68
|
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
69
|
|
|
59
70
|
## Extra Web installation steps
|
|
60
|
-
Add `import '@capacitor-community/camera-preview'` to you entry script in ionic on `app.module.ts`, so capacitor can register the web platform from the plugin
|
|
61
|
-
|
|
62
|
-
then in html add
|
|
63
71
|
|
|
64
|
-
|
|
72
|
+
Add `import { CameraPreview } from '@capacitor-community/camera-preview';` in the file where you want to use the plugin.
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
ngOnInit() { const { CameraPreview } = Plugins; CameraPreview.start({ parent: "cameraPreview"}); }
|
|
74
|
+
then in html add `<div id="cameraPreview"></div>`
|
|
68
75
|
|
|
69
|
-
|
|
76
|
+
and `CameraPreview.start({ parent: "cameraPreview"});` will work.
|
|
70
77
|
|
|
71
78
|
|
|
72
79
|
# Methods
|
|
@@ -257,7 +264,7 @@ const CameraPreviewFlashMode: CameraPreviewFlashMode = 'torch';
|
|
|
257
264
|
CameraPreview.setFlashMode(cameraPreviewFlashMode);
|
|
258
265
|
```
|
|
259
266
|
|
|
260
|
-
### startRecordVideo(options) ---- ANDROID only
|
|
267
|
+
### startRecordVideo(options) ---- ANDROID and iOS only
|
|
261
268
|
|
|
262
269
|
<info>Start capturing video</info><br/>
|
|
263
270
|
|
|
@@ -271,13 +278,12 @@ const cameraPreviewOptions: CameraPreviewOptions = {
|
|
|
271
278
|
CameraPreview.startRecordVideo(cameraPreviewOptions);
|
|
272
279
|
```
|
|
273
280
|
|
|
274
|
-
### stopRecordVideo() ---- ANDROID only
|
|
281
|
+
### stopRecordVideo() ---- ANDROID and iOS only
|
|
275
282
|
|
|
276
283
|
<info>Finish capturing a video. The captured video will be returned as a file path and the video format is .mp4</info><br/>
|
|
277
284
|
|
|
278
285
|
```javascript
|
|
279
286
|
const resultRecordVideo = await CameraPreview.stopRecordVideo();
|
|
280
|
-
this.stopCamera();
|
|
281
287
|
```
|
|
282
288
|
|
|
283
289
|
### setOpacity(options: CameraOpacityOptions): Promise<{}>; ---- ANDROID only
|
|
Binary file
|
package/android/.gradle/{4.10.1/fileHashes/fileHashes.bin → 8.0.2/checksums/md5-checksums.bin}
RENAMED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
4
|
+
androidxExifInterfaceVersion = project.hasProperty('androidxExifInterfaceVersion') ? rootProject.ext.androidxExifInterfaceVersion : '1.3.6'
|
|
5
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
6
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
buildscript {
|
|
@@ -11,20 +12,21 @@ buildscript {
|
|
|
11
12
|
google()
|
|
12
13
|
}
|
|
13
14
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:
|
|
15
|
+
classpath 'com.android.tools.build:gradle:8.0.0'
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
apply plugin: 'com.android.library'
|
|
19
20
|
|
|
20
21
|
android {
|
|
21
|
-
|
|
22
|
+
namespace "com.ahm.capacitor.camera.preview.capacitorcamerapreview"
|
|
23
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 33
|
|
22
24
|
defaultConfig {
|
|
23
25
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
24
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
26
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 33
|
|
25
27
|
versionCode 1
|
|
26
28
|
versionName "1.0"
|
|
27
|
-
testInstrumentationRunner "
|
|
29
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
28
30
|
}
|
|
29
31
|
buildTypes {
|
|
30
32
|
release {
|
|
@@ -47,7 +49,7 @@ dependencies {
|
|
|
47
49
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
48
50
|
implementation project(':capacitor-android')
|
|
49
51
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
50
|
-
implementation
|
|
52
|
+
implementation "androidx.exifinterface:exifinterface:$androidxExifInterfaceVersion"
|
|
51
53
|
testImplementation "junit:junit:$junitVersion"
|
|
52
54
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
53
55
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
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-8.0.2-all.zip
|
|
4
|
+
networkTimeout=10000
|
|
4
5
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
6
|
zipStorePath=wrapper/dists
|
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
# The setting is particularly useful for tweaking memory settings.
|
|
12
12
|
org.gradle.jvmargs=-Xmx1536m
|
|
13
13
|
android.useAndroidX=true
|
|
14
|
-
android.enableJetifier=true
|
|
15
14
|
# When configured, Gradle will run in incubating parallel mode.
|
|
16
15
|
# This option should only be used with decoupled projects. More details, visit
|
|
17
16
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
|
18
17
|
# org.gradle.parallel=true
|
|
18
|
+
|
package/android/gradlew
CHANGED
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
# Darwin, MinGW, and NonStop.
|
|
56
56
|
#
|
|
57
57
|
# (3) This script is generated from the Groovy template
|
|
58
|
-
# https://github.com/gradle/gradle/blob/
|
|
58
|
+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
59
59
|
# within the Gradle project.
|
|
60
60
|
#
|
|
61
61
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
@@ -80,10 +80,10 @@ do
|
|
|
80
80
|
esac
|
|
81
81
|
done
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
APP_NAME="Gradle"
|
|
83
|
+
# This is normally unused
|
|
84
|
+
# shellcheck disable=SC2034
|
|
86
85
|
APP_BASE_NAME=${0##*/}
|
|
86
|
+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
|
87
87
|
|
|
88
88
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
89
89
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
@@ -143,12 +143,16 @@ fi
|
|
|
143
143
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
144
144
|
case $MAX_FD in #(
|
|
145
145
|
max*)
|
|
146
|
+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
147
|
+
# shellcheck disable=SC3045
|
|
146
148
|
MAX_FD=$( ulimit -H -n ) ||
|
|
147
149
|
warn "Could not query maximum file descriptor limit"
|
|
148
150
|
esac
|
|
149
151
|
case $MAX_FD in #(
|
|
150
152
|
'' | soft) :;; #(
|
|
151
153
|
*)
|
|
154
|
+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
155
|
+
# shellcheck disable=SC3045
|
|
152
156
|
ulimit -n "$MAX_FD" ||
|
|
153
157
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
154
158
|
esac
|
|
@@ -205,6 +209,12 @@ set -- \
|
|
|
205
209
|
org.gradle.wrapper.GradleWrapperMain \
|
|
206
210
|
"$@"
|
|
207
211
|
|
|
212
|
+
# Stop when "xargs" is not available.
|
|
213
|
+
if ! command -v xargs >/dev/null 2>&1
|
|
214
|
+
then
|
|
215
|
+
die "xargs is not available"
|
|
216
|
+
fi
|
|
217
|
+
|
|
208
218
|
# Use "xargs" to parse quoted args.
|
|
209
219
|
#
|
|
210
220
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
package/android/gradlew.bat
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
@
|
|
1
|
+
@rem
|
|
2
|
+
@rem Copyright 2015 the original author or authors.
|
|
3
|
+
@rem
|
|
4
|
+
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
@rem you may not use this file except in compliance with the License.
|
|
6
|
+
@rem You may obtain a copy of the License at
|
|
7
|
+
@rem
|
|
8
|
+
@rem https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
@rem
|
|
10
|
+
@rem Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
@rem See the License for the specific language governing permissions and
|
|
14
|
+
@rem limitations under the License.
|
|
15
|
+
@rem
|
|
16
|
+
|
|
17
|
+
@if "%DEBUG%"=="" @echo off
|
|
2
18
|
@rem ##########################################################################
|
|
3
19
|
@rem
|
|
4
20
|
@rem Gradle startup script for Windows
|
|
@@ -8,20 +24,24 @@
|
|
|
8
24
|
@rem Set local scope for the variables with windows NT shell
|
|
9
25
|
if "%OS%"=="Windows_NT" setlocal
|
|
10
26
|
|
|
11
|
-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
12
|
-
set DEFAULT_JVM_OPTS=
|
|
13
|
-
|
|
14
27
|
set DIRNAME=%~dp0
|
|
15
|
-
if "%DIRNAME%"
|
|
28
|
+
if "%DIRNAME%"=="" set DIRNAME=.
|
|
29
|
+
@rem This is normally unused
|
|
16
30
|
set APP_BASE_NAME=%~n0
|
|
17
31
|
set APP_HOME=%DIRNAME%
|
|
18
32
|
|
|
33
|
+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
|
34
|
+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
|
35
|
+
|
|
36
|
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
37
|
+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
|
38
|
+
|
|
19
39
|
@rem Find java.exe
|
|
20
40
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
|
21
41
|
|
|
22
42
|
set JAVA_EXE=java.exe
|
|
23
43
|
%JAVA_EXE% -version >NUL 2>&1
|
|
24
|
-
if
|
|
44
|
+
if %ERRORLEVEL% equ 0 goto execute
|
|
25
45
|
|
|
26
46
|
echo.
|
|
27
47
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
@@ -35,7 +55,7 @@ goto fail
|
|
|
35
55
|
set JAVA_HOME=%JAVA_HOME:"=%
|
|
36
56
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|
37
57
|
|
|
38
|
-
if exist "%JAVA_EXE%" goto
|
|
58
|
+
if exist "%JAVA_EXE%" goto execute
|
|
39
59
|
|
|
40
60
|
echo.
|
|
41
61
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
|
@@ -45,44 +65,26 @@ echo location of your Java installation.
|
|
|
45
65
|
|
|
46
66
|
goto fail
|
|
47
67
|
|
|
48
|
-
:init
|
|
49
|
-
@rem Get command-line arguments, handling Windowz variants
|
|
50
|
-
|
|
51
|
-
if not "%OS%" == "Windows_NT" goto win9xME_args
|
|
52
|
-
if "%@eval[2+2]" == "4" goto 4NT_args
|
|
53
|
-
|
|
54
|
-
:win9xME_args
|
|
55
|
-
@rem Slurp the command line arguments.
|
|
56
|
-
set CMD_LINE_ARGS=
|
|
57
|
-
set _SKIP=2
|
|
58
|
-
|
|
59
|
-
:win9xME_args_slurp
|
|
60
|
-
if "x%~1" == "x" goto execute
|
|
61
|
-
|
|
62
|
-
set CMD_LINE_ARGS=%*
|
|
63
|
-
goto execute
|
|
64
|
-
|
|
65
|
-
:4NT_args
|
|
66
|
-
@rem Get arguments from the 4NT Shell from JP Software
|
|
67
|
-
set CMD_LINE_ARGS=%$
|
|
68
|
-
|
|
69
68
|
:execute
|
|
70
69
|
@rem Setup the command line
|
|
71
70
|
|
|
72
71
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|
73
72
|
|
|
73
|
+
|
|
74
74
|
@rem Execute Gradle
|
|
75
|
-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain
|
|
75
|
+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
|
76
76
|
|
|
77
77
|
:end
|
|
78
78
|
@rem End local scope for the variables with windows NT shell
|
|
79
|
-
if
|
|
79
|
+
if %ERRORLEVEL% equ 0 goto mainEnd
|
|
80
80
|
|
|
81
81
|
:fail
|
|
82
82
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
|
83
83
|
rem the _cmd.exe /c_ return code!
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
set EXIT_CODE=%ERRORLEVEL%
|
|
85
|
+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
|
86
|
+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
|
87
|
+
exit /b %EXIT_CODE%
|
|
86
88
|
|
|
87
89
|
:mainEnd
|
|
88
90
|
if "%OS%"=="Windows_NT" endlocal
|
|
@@ -3,8 +3,8 @@ package com.getcapacitor.android;
|
|
|
3
3
|
import static org.junit.Assert.*;
|
|
4
4
|
|
|
5
5
|
import android.content.Context;
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
|
7
|
+
import androidx.test.platform.app.InstrumentationRegistry;
|
|
8
8
|
import org.junit.Test;
|
|
9
9
|
import org.junit.runner.RunWith;
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ public class ExampleInstrumentedTest {
|
|
|
19
19
|
@Test
|
|
20
20
|
public void useAppContext() throws Exception {
|
|
21
21
|
// Context of the app under test.
|
|
22
|
-
Context appContext = InstrumentationRegistry.getTargetContext();
|
|
22
|
+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
|
23
23
|
|
|
24
24
|
assertEquals("com.getcapacitor.android", appContext.getPackageName());
|
|
25
25
|
}
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type CameraPosition = 'rear' | 'front';
|
|
2
2
|
export interface CameraPreviewOptions {
|
|
3
3
|
/** Parent element to attach the video preview element to (applicable to the web platform only) */
|
|
4
4
|
parent?: string;
|
|
@@ -49,14 +49,16 @@ export interface CameraSampleOptions {
|
|
|
49
49
|
/** The picture quality, 0 - 100, default 85 */
|
|
50
50
|
quality?: number;
|
|
51
51
|
}
|
|
52
|
-
export
|
|
52
|
+
export type CameraPreviewFlashMode = 'off' | 'on' | 'auto' | 'red-eye' | 'torch';
|
|
53
53
|
export interface CameraOpacityOptions {
|
|
54
54
|
/** The percent opacity to set for camera view, default 1 */
|
|
55
55
|
opacity?: number;
|
|
56
56
|
}
|
|
57
57
|
export interface CameraPreviewPlugin {
|
|
58
58
|
start(options: CameraPreviewOptions): Promise<{}>;
|
|
59
|
+
startRecordVideo(options: CameraPreviewOptions): Promise<{}>;
|
|
59
60
|
stop(): Promise<{}>;
|
|
61
|
+
stopRecordVideo(): Promise<{}>;
|
|
60
62
|
capture(options: CameraPreviewPictureOptions): Promise<{
|
|
61
63
|
value: string;
|
|
62
64
|
}>;
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,aAAa,GAAG,cAAc,CAAsB,eAAe,EAAE;IACzE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;CACjE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import { CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraPreviewFlashMode, CameraSampleOptions, CameraOpacityOptions } from './definitions';
|
|
2
|
+
import type { CameraPreviewOptions, CameraPreviewPictureOptions, CameraPreviewPlugin, CameraPreviewFlashMode, CameraSampleOptions, CameraOpacityOptions } from './definitions';
|
|
3
3
|
export declare class CameraPreviewWeb extends WebPlugin implements CameraPreviewPlugin {
|
|
4
4
|
/**
|
|
5
5
|
* track which camera is used based on start options
|
|
@@ -8,6 +8,8 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
|
|
|
8
8
|
private isBackCamera;
|
|
9
9
|
constructor();
|
|
10
10
|
start(options: CameraPreviewOptions): Promise<{}>;
|
|
11
|
+
startRecordVideo(): Promise<{}>;
|
|
12
|
+
stopRecordVideo(): Promise<{}>;
|
|
11
13
|
stop(): Promise<any>;
|
|
12
14
|
capture(options: CameraPreviewPictureOptions): Promise<any>;
|
|
13
15
|
captureSample(_options: CameraSampleOptions): Promise<any>;
|
|
@@ -20,5 +22,3 @@ export declare class CameraPreviewWeb extends WebPlugin implements CameraPreview
|
|
|
20
22
|
flip(): Promise<void>;
|
|
21
23
|
setOpacity(_options: CameraOpacityOptions): Promise<any>;
|
|
22
24
|
}
|
|
23
|
-
declare const CameraPreview: CameraPreviewWeb;
|
|
24
|
-
export { CameraPreview };
|
package/dist/esm/web.js
CHANGED
|
@@ -11,7 +11,7 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
11
11
|
await navigator.mediaDevices
|
|
12
12
|
.getUserMedia({
|
|
13
13
|
audio: !options.disableAudio,
|
|
14
|
-
video: true
|
|
14
|
+
video: true,
|
|
15
15
|
})
|
|
16
16
|
.then((stream) => {
|
|
17
17
|
// Stop any existing stream so we can request media with different constraints based on user input
|
|
@@ -45,8 +45,8 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
45
45
|
const constraints = {
|
|
46
46
|
video: {
|
|
47
47
|
width: { ideal: options.width },
|
|
48
|
-
height: { ideal: options.height }
|
|
49
|
-
}
|
|
48
|
+
height: { ideal: options.height },
|
|
49
|
+
},
|
|
50
50
|
};
|
|
51
51
|
if (options.position === 'rear') {
|
|
52
52
|
constraints.video.facingMode = 'environment';
|
|
@@ -70,14 +70,20 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
async startRecordVideo() {
|
|
74
|
+
throw this.unimplemented('Not implemented on web.');
|
|
75
|
+
}
|
|
76
|
+
async stopRecordVideo() {
|
|
77
|
+
throw this.unimplemented('Not implemented on web.');
|
|
78
|
+
}
|
|
73
79
|
async stop() {
|
|
74
80
|
const video = document.getElementById('video');
|
|
75
81
|
if (video) {
|
|
76
82
|
video.pause();
|
|
77
83
|
const st = video.srcObject;
|
|
78
84
|
const tracks = st.getTracks();
|
|
79
|
-
for (
|
|
80
|
-
|
|
85
|
+
for (let i = 0; i < tracks.length; i++) {
|
|
86
|
+
const track = tracks[i];
|
|
81
87
|
track.stop();
|
|
82
88
|
}
|
|
83
89
|
video.remove();
|
|
@@ -99,7 +105,9 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
99
105
|
context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
|
100
106
|
let base64EncodedImage;
|
|
101
107
|
if (options.quality != undefined) {
|
|
102
|
-
base64EncodedImage = canvas
|
|
108
|
+
base64EncodedImage = canvas
|
|
109
|
+
.toDataURL('image/jpeg', options.quality / 100.0)
|
|
110
|
+
.replace('data:image/jpeg;base64,', '');
|
|
103
111
|
}
|
|
104
112
|
else {
|
|
105
113
|
base64EncodedImage = canvas.toDataURL('image/png').replace('data:image/png;base64,', '');
|
|
@@ -128,8 +136,4 @@ export class CameraPreviewWeb extends WebPlugin {
|
|
|
128
136
|
}
|
|
129
137
|
}
|
|
130
138
|
}
|
|
131
|
-
const CameraPreview = new CameraPreviewWeb();
|
|
132
|
-
export { CameraPreview };
|
|
133
|
-
import { registerWebPlugin } from '@capacitor/core';
|
|
134
|
-
registerWebPlugin(CameraPreview);
|
|
135
139
|
//# sourceMappingURL=web.js.map
|
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAO7C;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,eAAe;YACrB,SAAS,EAAE,CAAC,KAAK,CAAC;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,OAA6B;QACvC,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YAC3C,MAAM,SAAS,CAAC,YAAY;iBACzB,YAAY,CAAC;gBACZ,KAAK,EAAE,CAAC,OAAO,CAAC,YAAY;gBAC5B,KAAK,EAAE,IAAI;aACZ,CAAC;iBACD,IAAI,CAAC,CAAC,MAAmB,EAAE,EAAE;gBAC5B,kGAAkG;gBAClG,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YACtD,CAAC,CAAC;iBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;YAEL,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAG,QAAQ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