@capacitor-community/camera-preview 5.0.0-0 → 6.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/CapacitorCommunityCameraPreview.podspec +16 -13
- package/README.md +21 -13
- package/android/build.gradle +6 -5
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/android/gradlew +8 -4
- package/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +3 -3
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraActivity.java +5 -7
- package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +0 -9
- package/dist/esm/definitions.d.ts +2 -0
- 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/PluginTests/PluginTests.swift +0 -19
- package/ios/Podfile +7 -4
- package/ios/Podfile.lock +9 -10
- package/package.json +16 -8
- package/android/.gradle/8.0.2/checksums/checksums.lock +0 -0
- package/android/.gradle/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/dependencies-accessors/gc.properties +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/fileChanges/last-build.bin +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/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
require 'json'
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'CapacitorCommunityCameraPreview'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.license = package['license']
|
|
10
|
+
s.homepage = 'https://github.com/capacitor-community/camera-preview.git'
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.source = { :git => 'https://github.com/capacitor-community/camera-preview.git', :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
CHANGED
|
@@ -2,14 +2,21 @@
|
|
|
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 6 of this plugin requires Capacitor 6.
|
|
12
|
+
|
|
13
|
+
If you are using Capacitor 5, use [version 5](https://github.com/capacitor-community/camera-preview/releases/tag/v5.0.0)
|
|
14
|
+
|
|
15
|
+
If you are using Capacitor 4, use [version 4](https://github.com/capacitor-community/camera-preview/releases/tag/v4.0.0)
|
|
16
|
+
|
|
17
|
+
If you are using Capacitor 3, use [version 3](https://github.com/capacitor-community/camera-preview/releases/tag/v3.1.2)
|
|
18
|
+
|
|
19
|
+
If you are using Capacitor 2, use [version 1](https://github.com/capacitor-community/camera-preview/releases/tag/v1.2.1)
|
|
13
20
|
|
|
14
21
|
**PR's are greatly appreciated.**
|
|
15
22
|
|
|
@@ -53,20 +60,22 @@ Open `android/app/src/main/AndroidManifest.xml` and above the closing `</manifes
|
|
|
53
60
|
```
|
|
54
61
|
For more help consult the [Capacitor docs](https://capacitorjs.com/docs/android/configuration#configuring-androidmanifestxml).
|
|
55
62
|
|
|
63
|
+
### Variables
|
|
64
|
+
|
|
65
|
+
This plugin will use the following project variables (defined in your app's `variables.gradle` file):
|
|
66
|
+
|
|
67
|
+
- `androidxExifInterfaceVersion`: version of `androidx.exifinterface:exifinterface` (default: `1.3.6`)
|
|
68
|
+
|
|
56
69
|
## Extra iOS installation steps
|
|
57
70
|
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
71
|
|
|
59
72
|
## 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
73
|
|
|
64
|
-
|
|
74
|
+
Add `import { CameraPreview } from '@capacitor-community/camera-preview';` in the file where you want to use the plugin.
|
|
65
75
|
|
|
66
|
-
|
|
67
|
-
ngOnInit() { const { CameraPreview } = Plugins; CameraPreview.start({ parent: "cameraPreview"}); }
|
|
76
|
+
then in html add `<div id="cameraPreview"></div>`
|
|
68
77
|
|
|
69
|
-
|
|
78
|
+
and `CameraPreview.start({ parent: "cameraPreview"});` will work.
|
|
70
79
|
|
|
71
80
|
|
|
72
81
|
# Methods
|
|
@@ -257,7 +266,7 @@ const CameraPreviewFlashMode: CameraPreviewFlashMode = 'torch';
|
|
|
257
266
|
CameraPreview.setFlashMode(cameraPreviewFlashMode);
|
|
258
267
|
```
|
|
259
268
|
|
|
260
|
-
### startRecordVideo(options) ---- ANDROID only
|
|
269
|
+
### startRecordVideo(options) ---- ANDROID and iOS only
|
|
261
270
|
|
|
262
271
|
<info>Start capturing video</info><br/>
|
|
263
272
|
|
|
@@ -271,13 +280,12 @@ const cameraPreviewOptions: CameraPreviewOptions = {
|
|
|
271
280
|
CameraPreview.startRecordVideo(cameraPreviewOptions);
|
|
272
281
|
```
|
|
273
282
|
|
|
274
|
-
### stopRecordVideo() ---- ANDROID only
|
|
283
|
+
### stopRecordVideo() ---- ANDROID and iOS only
|
|
275
284
|
|
|
276
285
|
<info>Finish capturing a video. The captured video will be returned as a file path and the video format is .mp4</info><br/>
|
|
277
286
|
|
|
278
287
|
```javascript
|
|
279
288
|
const resultRecordVideo = await CameraPreview.stopRecordVideo();
|
|
280
|
-
this.stopCamera();
|
|
281
289
|
```
|
|
282
290
|
|
|
283
291
|
### setOpacity(options: CameraOpacityOptions): Promise<{}>; ---- ANDROID only
|
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
ext {
|
|
2
2
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
3
|
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
|
|
4
|
+
androidxExifInterfaceVersion = project.hasProperty('androidxExifInterfaceVersion') ? rootProject.ext.androidxExifInterfaceVersion : '1.3.6'
|
|
4
5
|
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
|
|
5
6
|
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
|
|
6
7
|
}
|
|
@@ -11,7 +12,7 @@ buildscript {
|
|
|
11
12
|
google()
|
|
12
13
|
}
|
|
13
14
|
dependencies {
|
|
14
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
15
|
+
classpath 'com.android.tools.build:gradle:8.2.1'
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -19,13 +20,13 @@ apply plugin: 'com.android.library'
|
|
|
19
20
|
|
|
20
21
|
android {
|
|
21
22
|
namespace "com.ahm.capacitor.camera.preview.capacitorcamerapreview"
|
|
22
|
-
|
|
23
|
+
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
|
|
23
24
|
defaultConfig {
|
|
24
25
|
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
26
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
|
|
26
27
|
versionCode 1
|
|
27
28
|
versionName "1.0"
|
|
28
|
-
testInstrumentationRunner "
|
|
29
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
30
|
}
|
|
30
31
|
buildTypes {
|
|
31
32
|
release {
|
|
@@ -48,7 +49,7 @@ dependencies {
|
|
|
48
49
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
49
50
|
implementation project(':capacitor-android')
|
|
50
51
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
51
|
-
implementation
|
|
52
|
+
implementation "androidx.exifinterface:exifinterface:$androidxExifInterfaceVersion"
|
|
52
53
|
testImplementation "junit:junit:$junitVersion"
|
|
53
54
|
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
54
55
|
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
|
+
validateDistributionUrl=true
|
|
5
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
6
7
|
zipStorePath=wrapper/dists
|
package/android/gradlew
CHANGED
|
@@ -85,9 +85,6 @@ done
|
|
|
85
85
|
APP_BASE_NAME=${0##*/}
|
|
86
86
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
|
87
87
|
|
|
88
|
-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
89
|
-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
90
|
-
|
|
91
88
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
92
89
|
MAX_FD=maximum
|
|
93
90
|
|
|
@@ -133,10 +130,13 @@ location of your Java installation."
|
|
|
133
130
|
fi
|
|
134
131
|
else
|
|
135
132
|
JAVACMD=java
|
|
136
|
-
|
|
133
|
+
if ! command -v java >/dev/null 2>&1
|
|
134
|
+
then
|
|
135
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
137
136
|
|
|
138
137
|
Please set the JAVA_HOME variable in your environment to match the
|
|
139
138
|
location of your Java installation."
|
|
139
|
+
fi
|
|
140
140
|
fi
|
|
141
141
|
|
|
142
142
|
# Increase the maximum file descriptors if we can.
|
|
@@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
|
|
|
197
197
|
done
|
|
198
198
|
fi
|
|
199
199
|
|
|
200
|
+
|
|
201
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
202
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
203
|
+
|
|
200
204
|
# Collect all arguments for the java command;
|
|
201
205
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
|
202
206
|
# shell script including quotes and variable substitutions, so put them in
|
|
@@ -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
|
}
|
|
@@ -47,15 +47,6 @@ public class CameraPreview extends Plugin implements CameraActivity.CameraPrevie
|
|
|
47
47
|
private CameraActivity fragment;
|
|
48
48
|
private int containerViewId = 20;
|
|
49
49
|
|
|
50
|
-
@PluginMethod
|
|
51
|
-
public void echo(PluginCall call) {
|
|
52
|
-
String value = call.getString("value");
|
|
53
|
-
|
|
54
|
-
JSObject ret = new JSObject();
|
|
55
|
-
ret.put("value", value);
|
|
56
|
-
call.resolve(ret);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
50
|
@PluginMethod
|
|
60
51
|
public void start(PluginCall call) {
|
|
61
52
|
if (PermissionState.GRANTED.equals(getPermissionState(CAMERA_PERMISSION_ALIAS))) {
|
|
@@ -56,7 +56,9 @@ export interface CameraOpacityOptions {
|
|
|
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,S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AAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,QAA8B;QAC7C,MAAM,KAAK,GAAqB,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACjE,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YACpC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;SACpE;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@capacitor/core');
|
|
6
|
+
|
|
7
|
+
const CameraPreview = core.registerPlugin('CameraPreview', {
|
|
8
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CameraPreviewWeb()),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
class CameraPreviewWeb extends core.WebPlugin {
|
|
12
|
+
constructor() {
|
|
13
|
+
super({
|
|
14
|
+
name: 'CameraPreview',
|
|
15
|
+
platforms: ['web'],
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
async start(options) {
|
|
19
|
+
return new Promise(async (resolve, reject) => {
|
|
20
|
+
await navigator.mediaDevices
|
|
21
|
+
.getUserMedia({
|
|
22
|
+
audio: !options.disableAudio,
|
|
23
|
+
video: true,
|
|
24
|
+
})
|
|
25
|
+
.then((stream) => {
|
|
26
|
+
// Stop any existing stream so we can request media with different constraints based on user input
|
|
27
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
28
|
+
})
|
|
29
|
+
.catch((error) => {
|
|
30
|
+
reject(error);
|
|
31
|
+
});
|
|
32
|
+
const video = document.getElementById('video');
|
|
33
|
+
const parent = document.getElementById(options.parent);
|
|
34
|
+
if (!video) {
|
|
35
|
+
const videoElement = document.createElement('video');
|
|
36
|
+
videoElement.id = 'video';
|
|
37
|
+
videoElement.setAttribute('class', options.className || '');
|
|
38
|
+
// Don't flip video feed if camera is rear facing
|
|
39
|
+
if (options.position !== 'rear') {
|
|
40
|
+
videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');
|
|
41
|
+
}
|
|
42
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
43
|
+
const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
|
|
44
|
+
// Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful
|
|
45
|
+
// Without these attributes videoElement.play() will throw a NotAllowedError
|
|
46
|
+
// https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari
|
|
47
|
+
if (isSafari) {
|
|
48
|
+
videoElement.setAttribute('autoplay', 'true');
|
|
49
|
+
videoElement.setAttribute('muted', 'true');
|
|
50
|
+
videoElement.setAttribute('playsinline', 'true');
|
|
51
|
+
}
|
|
52
|
+
parent.appendChild(videoElement);
|
|
53
|
+
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
54
|
+
const constraints = {
|
|
55
|
+
video: {
|
|
56
|
+
width: { ideal: options.width },
|
|
57
|
+
height: { ideal: options.height },
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
if (options.position === 'rear') {
|
|
61
|
+
constraints.video.facingMode = 'environment';
|
|
62
|
+
this.isBackCamera = true;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
this.isBackCamera = false;
|
|
66
|
+
}
|
|
67
|
+
navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
|
|
68
|
+
//video.src = window.URL.createObjectURL(stream);
|
|
69
|
+
videoElement.srcObject = stream;
|
|
70
|
+
videoElement.play();
|
|
71
|
+
resolve({});
|
|
72
|
+
}, (err) => {
|
|
73
|
+
reject(err);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
reject({ message: 'camera already started' });
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async startRecordVideo() {
|
|
83
|
+
throw this.unimplemented('Not implemented on web.');
|
|
84
|
+
}
|
|
85
|
+
async stopRecordVideo() {
|
|
86
|
+
throw this.unimplemented('Not implemented on web.');
|
|
87
|
+
}
|
|
88
|
+
async stop() {
|
|
89
|
+
const video = document.getElementById('video');
|
|
90
|
+
if (video) {
|
|
91
|
+
video.pause();
|
|
92
|
+
const st = video.srcObject;
|
|
93
|
+
const tracks = st.getTracks();
|
|
94
|
+
for (let i = 0; i < tracks.length; i++) {
|
|
95
|
+
const track = tracks[i];
|
|
96
|
+
track.stop();
|
|
97
|
+
}
|
|
98
|
+
video.remove();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async capture(options) {
|
|
102
|
+
return new Promise((resolve, _) => {
|
|
103
|
+
const video = document.getElementById('video');
|
|
104
|
+
const canvas = document.createElement('canvas');
|
|
105
|
+
// video.width = video.offsetWidth;
|
|
106
|
+
const context = canvas.getContext('2d');
|
|
107
|
+
canvas.width = video.videoWidth;
|
|
108
|
+
canvas.height = video.videoHeight;
|
|
109
|
+
// flip horizontally back camera isn't used
|
|
110
|
+
if (!this.isBackCamera) {
|
|
111
|
+
context.translate(video.videoWidth, 0);
|
|
112
|
+
context.scale(-1, 1);
|
|
113
|
+
}
|
|
114
|
+
context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
|
115
|
+
let base64EncodedImage;
|
|
116
|
+
if (options.quality != undefined) {
|
|
117
|
+
base64EncodedImage = canvas
|
|
118
|
+
.toDataURL('image/jpeg', options.quality / 100.0)
|
|
119
|
+
.replace('data:image/jpeg;base64,', '');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
base64EncodedImage = canvas.toDataURL('image/png').replace('data:image/png;base64,', '');
|
|
123
|
+
}
|
|
124
|
+
resolve({
|
|
125
|
+
value: base64EncodedImage,
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
async captureSample(_options) {
|
|
130
|
+
return this.capture(_options);
|
|
131
|
+
}
|
|
132
|
+
async getSupportedFlashModes() {
|
|
133
|
+
throw new Error('getSupportedFlashModes not supported under the web platform');
|
|
134
|
+
}
|
|
135
|
+
async setFlashMode(_options) {
|
|
136
|
+
throw new Error('setFlashMode not supported under the web platform');
|
|
137
|
+
}
|
|
138
|
+
async flip() {
|
|
139
|
+
throw new Error('flip not supported under the web platform');
|
|
140
|
+
}
|
|
141
|
+
async setOpacity(_options) {
|
|
142
|
+
const video = document.getElementById('video');
|
|
143
|
+
if (!!video && !!_options['opacity']) {
|
|
144
|
+
video.style.setProperty('opacity', _options['opacity'].toString());
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
150
|
+
__proto__: null,
|
|
151
|
+
CameraPreviewWeb: CameraPreviewWeb
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
exports.CameraPreview = CameraPreview;
|
|
155
|
+
//# sourceMappingURL=plugin.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CameraPreview = registerPlugin('CameraPreview', {\n web: () => import('./web').then((m) => new m.CameraPreviewWeb()),\n});\nexport * from './definitions';\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: 'CameraPreview',\n platforms: ['web'],\n });\n }\n async start(options) {\n return new Promise(async (resolve, reject) => {\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach((track) => track.stop());\n })\n .catch((error) => {\n reject(error);\n });\n const video = document.getElementById('video');\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement('video');\n videoElement.id = 'video';\n videoElement.setAttribute('class', options.className || '');\n // Don't flip video feed if camera is rear facing\n if (options.position !== 'rear') {\n videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute('autoplay', 'true');\n videoElement.setAttribute('muted', 'true');\n videoElement.setAttribute('playsinline', 'true');\n }\n parent.appendChild(videoElement);\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === 'rear') {\n constraints.video.facingMode = 'environment';\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {\n //video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n resolve({});\n }, (err) => {\n reject(err);\n });\n }\n }\n else {\n reject({ message: 'camera already started' });\n }\n });\n }\n async startRecordVideo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async stopRecordVideo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async stop() {\n const video = document.getElementById('video');\n if (video) {\n video.pause();\n const st = video.srcObject;\n const tracks = st.getTracks();\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n track.stop();\n }\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, _) => {\n const video = document.getElementById('video');\n const canvas = document.createElement('canvas');\n // video.width = video.offsetWidth;\n const context = canvas.getContext('2d');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n let base64EncodedImage;\n if (options.quality != undefined) {\n base64EncodedImage = canvas\n .toDataURL('image/jpeg', options.quality / 100.0)\n .replace('data:image/jpeg;base64,', '');\n }\n else {\n base64EncodedImage = canvas.toDataURL('image/png').replace('data:image/png;base64,', '');\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async getSupportedFlashModes() {\n throw new Error('getSupportedFlashModes not supported under the web platform');\n }\n async setFlashMode(_options) {\n throw new Error('setFlashMode not supported under the web platform');\n }\n async flip() {\n throw new Error('flip not supported under the web platform');\n }\n async setOpacity(_options) {\n const video = document.getElementById('video');\n if (!!video && !!_options['opacity']) {\n video.style.setProperty('opacity', _options['opacity'].toString());\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;AAChD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,eAAe;AACjC,YAAY,SAAS,EAAE,CAAC,KAAK,CAAC;AAC9B,SAAS,CAAC,CAAC;AACX,KAAK;AACL,IAAI,MAAM,KAAK,CAAC,OAAO,EAAE;AACzB,QAAQ,OAAO,IAAI,OAAO,CAAC,OAAO,OAAO,EAAE,MAAM,KAAK;AACtD,YAAY,MAAM,SAAS,CAAC,YAAY;A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A6D,CAAC,CAAC;AACvF,KAAK;AACL,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;AACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;AAC7E,KAAK;AACL,IAAI,MAAM,IAAI,GAAG;AACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;AACrE,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;AAC/B,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACvD,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;AAC9C,YAAY,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAC/E,SAAS;AACT,KAAK;AACL;;;;;;;;;"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
var capacitorSplashScreen = (function (exports, core) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const CameraPreview = core.registerPlugin('CameraPreview', {
|
|
5
|
+
web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CameraPreviewWeb()),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
class CameraPreviewWeb extends core.WebPlugin {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
name: 'CameraPreview',
|
|
12
|
+
platforms: ['web'],
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async start(options) {
|
|
16
|
+
return new Promise(async (resolve, reject) => {
|
|
17
|
+
await navigator.mediaDevices
|
|
18
|
+
.getUserMedia({
|
|
19
|
+
audio: !options.disableAudio,
|
|
20
|
+
video: true,
|
|
21
|
+
})
|
|
22
|
+
.then((stream) => {
|
|
23
|
+
// Stop any existing stream so we can request media with different constraints based on user input
|
|
24
|
+
stream.getTracks().forEach((track) => track.stop());
|
|
25
|
+
})
|
|
26
|
+
.catch((error) => {
|
|
27
|
+
reject(error);
|
|
28
|
+
});
|
|
29
|
+
const video = document.getElementById('video');
|
|
30
|
+
const parent = document.getElementById(options.parent);
|
|
31
|
+
if (!video) {
|
|
32
|
+
const videoElement = document.createElement('video');
|
|
33
|
+
videoElement.id = 'video';
|
|
34
|
+
videoElement.setAttribute('class', options.className || '');
|
|
35
|
+
// Don't flip video feed if camera is rear facing
|
|
36
|
+
if (options.position !== 'rear') {
|
|
37
|
+
videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');
|
|
38
|
+
}
|
|
39
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
40
|
+
const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
|
|
41
|
+
// Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful
|
|
42
|
+
// Without these attributes videoElement.play() will throw a NotAllowedError
|
|
43
|
+
// https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari
|
|
44
|
+
if (isSafari) {
|
|
45
|
+
videoElement.setAttribute('autoplay', 'true');
|
|
46
|
+
videoElement.setAttribute('muted', 'true');
|
|
47
|
+
videoElement.setAttribute('playsinline', 'true');
|
|
48
|
+
}
|
|
49
|
+
parent.appendChild(videoElement);
|
|
50
|
+
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
51
|
+
const constraints = {
|
|
52
|
+
video: {
|
|
53
|
+
width: { ideal: options.width },
|
|
54
|
+
height: { ideal: options.height },
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
if (options.position === 'rear') {
|
|
58
|
+
constraints.video.facingMode = 'environment';
|
|
59
|
+
this.isBackCamera = true;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.isBackCamera = false;
|
|
63
|
+
}
|
|
64
|
+
navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
|
|
65
|
+
//video.src = window.URL.createObjectURL(stream);
|
|
66
|
+
videoElement.srcObject = stream;
|
|
67
|
+
videoElement.play();
|
|
68
|
+
resolve({});
|
|
69
|
+
}, (err) => {
|
|
70
|
+
reject(err);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
reject({ message: 'camera already started' });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async startRecordVideo() {
|
|
80
|
+
throw this.unimplemented('Not implemented on web.');
|
|
81
|
+
}
|
|
82
|
+
async stopRecordVideo() {
|
|
83
|
+
throw this.unimplemented('Not implemented on web.');
|
|
84
|
+
}
|
|
85
|
+
async stop() {
|
|
86
|
+
const video = document.getElementById('video');
|
|
87
|
+
if (video) {
|
|
88
|
+
video.pause();
|
|
89
|
+
const st = video.srcObject;
|
|
90
|
+
const tracks = st.getTracks();
|
|
91
|
+
for (let i = 0; i < tracks.length; i++) {
|
|
92
|
+
const track = tracks[i];
|
|
93
|
+
track.stop();
|
|
94
|
+
}
|
|
95
|
+
video.remove();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async capture(options) {
|
|
99
|
+
return new Promise((resolve, _) => {
|
|
100
|
+
const video = document.getElementById('video');
|
|
101
|
+
const canvas = document.createElement('canvas');
|
|
102
|
+
// video.width = video.offsetWidth;
|
|
103
|
+
const context = canvas.getContext('2d');
|
|
104
|
+
canvas.width = video.videoWidth;
|
|
105
|
+
canvas.height = video.videoHeight;
|
|
106
|
+
// flip horizontally back camera isn't used
|
|
107
|
+
if (!this.isBackCamera) {
|
|
108
|
+
context.translate(video.videoWidth, 0);
|
|
109
|
+
context.scale(-1, 1);
|
|
110
|
+
}
|
|
111
|
+
context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
|
112
|
+
let base64EncodedImage;
|
|
113
|
+
if (options.quality != undefined) {
|
|
114
|
+
base64EncodedImage = canvas
|
|
115
|
+
.toDataURL('image/jpeg', options.quality / 100.0)
|
|
116
|
+
.replace('data:image/jpeg;base64,', '');
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
base64EncodedImage = canvas.toDataURL('image/png').replace('data:image/png;base64,', '');
|
|
120
|
+
}
|
|
121
|
+
resolve({
|
|
122
|
+
value: base64EncodedImage,
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
async captureSample(_options) {
|
|
127
|
+
return this.capture(_options);
|
|
128
|
+
}
|
|
129
|
+
async getSupportedFlashModes() {
|
|
130
|
+
throw new Error('getSupportedFlashModes not supported under the web platform');
|
|
131
|
+
}
|
|
132
|
+
async setFlashMode(_options) {
|
|
133
|
+
throw new Error('setFlashMode not supported under the web platform');
|
|
134
|
+
}
|
|
135
|
+
async flip() {
|
|
136
|
+
throw new Error('flip not supported under the web platform');
|
|
137
|
+
}
|
|
138
|
+
async setOpacity(_options) {
|
|
139
|
+
const video = document.getElementById('video');
|
|
140
|
+
if (!!video && !!_options['opacity']) {
|
|
141
|
+
video.style.setProperty('opacity', _options['opacity'].toString());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
var web = /*#__PURE__*/Object.freeze({
|
|
147
|
+
__proto__: null,
|
|
148
|
+
CameraPreviewWeb: CameraPreviewWeb
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
exports.CameraPreview = CameraPreview;
|
|
152
|
+
|
|
153
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
154
|
+
|
|
155
|
+
return exports;
|
|
156
|
+
|
|
157
|
+
})({}, capacitorExports);
|
|
158
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CameraPreview = registerPlugin('CameraPreview', {\n web: () => import('./web').then((m) => new m.CameraPreviewWeb()),\n});\nexport * from './definitions';\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: 'CameraPreview',\n platforms: ['web'],\n });\n }\n async start(options) {\n return new Promise(async (resolve, reject) => {\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach((track) => track.stop());\n })\n .catch((error) => {\n reject(error);\n });\n const video = document.getElementById('video');\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement('video');\n videoElement.id = 'video';\n videoElement.setAttribute('class', options.className || '');\n // Don't flip video feed if camera is rear facing\n if (options.position !== 'rear') {\n videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute('autoplay', 'true');\n videoElement.setAttribute('muted', 'true');\n videoElement.setAttribute('playsinline', 'true');\n }\n parent.appendChild(videoElement);\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === 'rear') {\n constraints.video.facingMode = 'environment';\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {\n //video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n resolve({});\n }, (err) => {\n reject(err);\n });\n }\n }\n else {\n reject({ message: 'camera already started' });\n }\n });\n }\n async startRecordVideo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async stopRecordVideo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async stop() {\n const video = document.getElementById('video');\n if (video) {\n video.pause();\n const st = video.srcObject;\n const tracks = st.getTracks();\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n track.stop();\n }\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, _) => {\n const video = document.getElementById('video');\n const canvas = document.createElement('canvas');\n // video.width = video.offsetWidth;\n const context = canvas.getContext('2d');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n let base64EncodedImage;\n if (options.quality != undefined) {\n base64EncodedImage = canvas\n .toDataURL('image/jpeg', options.quality / 100.0)\n .replace('data:image/jpeg;base64,', '');\n }\n else {\n base64EncodedImage = canvas.toDataURL('image/png').replace('data:image/png;base64,', '');\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async getSupportedFlashModes() {\n throw new Error('getSupportedFlashModes not supported under the web platform');\n }\n async setFlashMode(_options) {\n throw new Error('setFlashMode not supported under the web platform');\n }\n async flip() {\n throw new Error('flip not supported under the web platform');\n }\n async setOpacity(_options) {\n const video = document.getElementById('video');\n if (!!video && !!_options['opacity']) {\n video.style.setProperty('opacity', _options['opacity'].toString());\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC;IACd,YAAY,IAAI,E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CAAC,CAAC;IACf,SAAS,CAAC,CAAC;IACX,KAAK;IACL,IAAI,MAAM,aAAa,CAAC,QAAQ,EAAE;IAClC,QAAQ,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,KAAK;IACL,IAAI,MAAM,sBAAsB,GAAG;IACnC,QAAQ,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACvF,KAAK;IACL,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAC7E,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACrE,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACvD,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;IAC9C,YAAY,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/E,SAAS;IACT,KAAK;IACL;;;;;;;;;;;;;;;;;"}
|
|
@@ -487,7 +487,7 @@ extension CameraController: AVCapturePhotoCaptureDelegate {
|
|
|
487
487
|
public func photoOutput(_ captureOutput: AVCapturePhotoOutput, didFinishProcessingPhoto photoSampleBuffer: CMSampleBuffer?, previewPhoto previewPhotoSampleBuffer: CMSampleBuffer?,
|
|
488
488
|
resolvedSettings: AVCaptureResolvedPhotoSettings, bracketSettings: AVCaptureBracketedStillImageSettings?, error: Swift.Error?) {
|
|
489
489
|
if let error = error { self.photoCaptureCompletionBlock?(nil, error) } else if let buffer = photoSampleBuffer, let data = AVCapturePhotoOutput.jpegPhotoDataRepresentation(forJPEGSampleBuffer: buffer, previewPhotoSampleBuffer: nil),
|
|
490
|
-
|
|
490
|
+
let image = UIImage(data: data) {
|
|
491
491
|
self.photoCaptureCompletionBlock?(image.fixedOrientation(), nil)
|
|
492
492
|
} else {
|
|
493
493
|
self.photoCaptureCompletionBlock?(nil, CameraControllerError.unknown)
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -24,7 +24,7 @@ public class CameraPreview: CAPPlugin {
|
|
|
24
24
|
var disableAudio: Bool = false
|
|
25
25
|
|
|
26
26
|
@objc func rotated() {
|
|
27
|
-
let height = self.paddingBottom != nil ? self.height! - self.paddingBottom!: self.height
|
|
27
|
+
let height = self.paddingBottom != nil ? self.height! - self.paddingBottom!: self.height!
|
|
28
28
|
|
|
29
29
|
if UIApplication.shared.statusBarOrientation.isLandscape {
|
|
30
30
|
self.previewView.frame = CGRect(x: self.y!, y: self.x!, width: max(height, self.width!), height: min(height, self.width!))
|
|
@@ -32,7 +32,7 @@ public class CameraPreview: CAPPlugin {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if UIApplication.shared.statusBarOrientation.isPortrait {
|
|
35
|
-
if
|
|
35
|
+
if self.previewView != nil && self.x != nil && self.y != nil && self.width != nil && self.height != nil {
|
|
36
36
|
self.previewView.frame = CGRect(x: self.x!, y: self.y!, width: min(height, self.width!), height: max(height, self.width!))
|
|
37
37
|
}
|
|
38
38
|
self.cameraController.previewLayer?.frame = self.previewView.frame
|
|
@@ -67,7 +67,7 @@ public class CameraPreview: CAPPlugin {
|
|
|
67
67
|
self.storeToFile = call.getBool("storeToFile") ?? false
|
|
68
68
|
self.enableZoom = call.getBool("enableZoom") ?? false
|
|
69
69
|
self.disableAudio = call.getBool("disableAudio") ?? false
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
AVCaptureDevice.requestAccess(for: .video, completionHandler: { (granted: Bool) in
|
|
72
72
|
guard granted else {
|
|
73
73
|
call.reject("permission failed")
|
|
@@ -78,7 +78,7 @@ public class CameraPreview: CAPPlugin {
|
|
|
78
78
|
if self.cameraController.captureSession?.isRunning ?? false {
|
|
79
79
|
call.reject("camera already started")
|
|
80
80
|
} else {
|
|
81
|
-
self.cameraController.prepare(cameraPosition: self.cameraPosition, disableAudio: self.disableAudio){error in
|
|
81
|
+
self.cameraController.prepare(cameraPosition: self.cameraPosition, disableAudio: self.disableAudio) {error in
|
|
82
82
|
if let error = error {
|
|
83
83
|
print(error)
|
|
84
84
|
call.reject(error.localizedDescription)
|
|
@@ -235,7 +235,7 @@ public class CameraPreview: CAPPlugin {
|
|
|
235
235
|
do {
|
|
236
236
|
var flashModeAsEnum: AVCaptureDevice.FlashMode?
|
|
237
237
|
switch flashMode {
|
|
238
|
-
case "off"
|
|
238
|
+
case "off":
|
|
239
239
|
flashModeAsEnum = AVCaptureDevice.FlashMode.off
|
|
240
240
|
case "on":
|
|
241
241
|
flashModeAsEnum = AVCaptureDevice.FlashMode.on
|
|
@@ -13,23 +13,4 @@ class PluginTests: XCTestCase {
|
|
|
13
13
|
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
|
14
14
|
super.tearDown()
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
func testEcho() {
|
|
18
|
-
// This is an example of a functional test case for a plugin.
|
|
19
|
-
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
20
|
-
|
|
21
|
-
let value = "Hello, World!"
|
|
22
|
-
let plugin = MyPlugin()
|
|
23
|
-
|
|
24
|
-
let call = CAPPluginCall(callbackId: "test", options: [
|
|
25
|
-
"value": value
|
|
26
|
-
], success: { (result, _) in
|
|
27
|
-
let resultValue = result!.data["value"] as? String
|
|
28
|
-
XCTAssertEqual(value, resultValue)
|
|
29
|
-
}, error: { (_) in
|
|
30
|
-
XCTFail("Error shouldn't have been called")
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
plugin.echo(call!)
|
|
34
|
-
}
|
|
35
16
|
}
|
package/ios/Podfile
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
platform :ios, '13.0'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
def capacitor_pods
|
|
4
4
|
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
|
|
5
5
|
use_frameworks!
|
|
6
6
|
pod 'Capacitor', :path => '../node_modules/@capacitor/ios'
|
|
7
|
+
pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios'
|
|
7
8
|
end
|
|
8
9
|
|
|
9
|
-
target '
|
|
10
|
-
|
|
10
|
+
target 'Plugin' do
|
|
11
|
+
capacitor_pods
|
|
12
|
+
end
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
target 'PluginTests' do
|
|
15
|
+
capacitor_pods
|
|
13
16
|
end
|
package/ios/Podfile.lock
CHANGED
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
PODS:
|
|
2
|
-
- Capacitor (
|
|
2
|
+
- Capacitor (5.0.3):
|
|
3
3
|
- CapacitorCordova
|
|
4
|
-
- CapacitorCordova (
|
|
4
|
+
- CapacitorCordova (5.0.3)
|
|
5
5
|
|
|
6
6
|
DEPENDENCIES:
|
|
7
7
|
- "Capacitor (from `../node_modules/@capacitor/ios`)"
|
|
8
|
-
|
|
9
|
-
SPEC REPOS:
|
|
10
|
-
trunk:
|
|
11
|
-
- CapacitorCordova
|
|
8
|
+
- "CapacitorCordova (from `../node_modules/@capacitor/ios`)"
|
|
12
9
|
|
|
13
10
|
EXTERNAL SOURCES:
|
|
14
11
|
Capacitor:
|
|
15
12
|
:path: "../node_modules/@capacitor/ios"
|
|
13
|
+
CapacitorCordova:
|
|
14
|
+
:path: "../node_modules/@capacitor/ios"
|
|
16
15
|
|
|
17
16
|
SPEC CHECKSUMS:
|
|
18
|
-
Capacitor:
|
|
19
|
-
CapacitorCordova:
|
|
17
|
+
Capacitor: 304a960e431f9e6f78556554ca71c41c1b2b9680
|
|
18
|
+
CapacitorCordova: def732a63679698df6fb392bbe6d269a0b61e937
|
|
20
19
|
|
|
21
|
-
PODFILE CHECKSUM:
|
|
20
|
+
PODFILE CHECKSUM: 14e8b2400457751b865e1c327e7cfa1c6fa67da6
|
|
22
21
|
|
|
23
|
-
COCOAPODS: 1.
|
|
22
|
+
COCOAPODS: 1.11.3
|
package/package.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-community/camera-preview",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Camera preview",
|
|
5
|
-
"main": "dist/
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
6
7
|
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"unpkg": "dist/plugin.js",
|
|
7
9
|
"scripts": {
|
|
8
|
-
"
|
|
10
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
11
|
+
"verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..",
|
|
12
|
+
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
13
|
+
"verify:web": "npm run build",
|
|
14
|
+
"build": "npm run clean && tsc && rollup -c rollup.config.js",
|
|
9
15
|
"clean": "rimraf './dist'",
|
|
10
16
|
"watch": "tsc --watch",
|
|
11
17
|
"lint": "concurrently -g \"npm:eslint\" \"npm:prettier -- --check\" \"npm run swiftlint -- lint ios\"",
|
|
@@ -18,12 +24,10 @@
|
|
|
18
24
|
},
|
|
19
25
|
"author": "Ariel Hernandez Musa",
|
|
20
26
|
"license": "MIT",
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@capacitor/core": "^5.0.0"
|
|
23
|
-
},
|
|
24
27
|
"devDependencies": {
|
|
25
|
-
"@capacitor/android": "^
|
|
26
|
-
"@capacitor/
|
|
28
|
+
"@capacitor/android": "^6.0.0",
|
|
29
|
+
"@capacitor/core": "^6.0.0",
|
|
30
|
+
"@capacitor/ios": "^6.0.0",
|
|
27
31
|
"@ionic/eslint-config": "^0.3.0",
|
|
28
32
|
"@ionic/prettier-config": "^2.0.0",
|
|
29
33
|
"@ionic/swiftlint-config": "^1.1.2",
|
|
@@ -34,9 +38,13 @@
|
|
|
34
38
|
"prettier-plugin-java": "^1.6.1",
|
|
35
39
|
"pretty-quick": "^3.1.3",
|
|
36
40
|
"rimraf": "^3.0.2",
|
|
41
|
+
"rollup": "^2.79.1",
|
|
37
42
|
"swiftlint": "^1.0.1",
|
|
38
43
|
"typescript": "^4.3.2"
|
|
39
44
|
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@capacitor/core": "^6.0.0"
|
|
47
|
+
},
|
|
40
48
|
"husky": {
|
|
41
49
|
"hooks": {
|
|
42
50
|
"pre-commit": "pretty-quick --staged"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|