Skip to content
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
50d492f
chore(*): update podfile
michaelwolz Jun 6, 2024
9ec31de
fix(ios): use native camera selection for optimal focus
michaelwolz Jun 6, 2024
9d7f6ac
fix(camera-controller): prefer regular wide angle camera over dual wi…
michaelwolz Jun 11, 2024
9e1a744
feat: camera up and running
michaelwolz Jun 21, 2024
30764a5
refactor(ios): large refactoring
michaelwolz Jun 22, 2024
f0fea9a
fix(ios): auto focus / zoom level
michaelwolz Jun 22, 2024
52f3a6c
chore: clean up and documentation
michaelwolz Jun 24, 2024
5595256
fix: re-enable high resolution output for iOS
michaelwolz Jun 24, 2024
631bb38
chore: documentation
michaelwolz Jun 24, 2024
2a664f4
fix(ios): improve performance when opening camera
michaelwolz Jun 24, 2024
5a858d4
fix: add permissions methods
michaelwolz Jun 24, 2024
e941601
fix: do not use virtual device on older iphones
michaelwolz Jun 24, 2024
5f34b76
fix(web): add missing implementations for web platform
michaelwolz Jun 24, 2024
f2d96d6
fix(ios): set photo preset for high resolution mode
michaelwolz Jun 25, 2024
9bd7af3
fix(ios): check focus / exposure mode support
michaelwolz Jun 26, 2024
5480293
fix(ios): initialize photo output before applying zoom factor
michaelwolz Jun 30, 2024
a3fe1fc
fix(ios): repair switching camera behavior
michaelwolz Jul 3, 2024
db16c0f
fix(android): front camera rotation
michaelwolz Jul 3, 2024
6dbccb6
fix(android): image rotation logic for front camera
michaelwolz Jul 3, 2024
bc57883
fix(ios): camera initialization on ios
michaelwolz Jul 4, 2024
93b5b74
docs: remove iOS support for video recording
michaelwolz Jul 8, 2024
0a846ed
feat(*): remove video recording functions
michaelwolz Jul 12, 2024
8fba530
docs: update readme
michaelwolz Jul 12, 2024
ea00fb1
docs: update readme
michaelwolz Aug 9, 2024
5f8a96b
fix(ios): improve type safety to prevent crashes
michaelwolz Aug 13, 2024
a158c61
Merge branch 'master' into release/next
michaelwolz Aug 13, 2024
dc2f4a8
Merge pull request #1 from michaelwolz/release/next
michaelwolz Aug 16, 2024
9b05b89
fix: update dependencies
michaelwolz Aug 16, 2024
a461347
chore: modify license
michaelwolz Aug 16, 2024
7dbfa49
build: add missing file references for iOS
michaelwolz Aug 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,23 @@ and `CameraPreview.start({ parent: "cameraPreview"});` will work.
Starts the camera preview instance.
<br>

| Option | values | descriptions |
|----------|---------------|------------------------------------------------------------------------|
| position | front \| rear | Show front or rear camera when start the preview. Defaults to front |
| width | number | (optional) The preview width in pixels, default window.screen.width (applicable to the android and ios platforms only) |
| height | number | (optional) The preview height in pixels, default window.screen.height (applicable to the android and ios platforms only) |
| x | number | (optional) The x origin, default 0 (applicable to the android and ios platforms only) |
| y | number | (optional) The y origin, default 0 (applicable to the android and ios platforms only) |
| toBack | boolean | (optional) Brings your html in front of your preview, default false (applicable to the android and ios platforms only) |
| paddingBottom | number | (optional) The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only) |
| rotateWhenOrientationChanged | boolean | (optional) Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) |
| storeToFile | boolean | (optional) Capture images to a file and return back the file path instead of returning base64 encoded data, default false. |
| disableExifHeaderStripping | boolean | (optional) Disable automatic rotation of the image, and let the browser deal with it, default true (applicable to the android and ios platforms only) |
| enableHighResolution | boolean | (optional) Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device |
| disableAudio | boolean | (optional) Disables audio stream to prevent permission requests, default false. (applicable to web and iOS only) |
| lockAndroidOrientation | boolean | (optional) Locks device orientation when camera is showing, default false. (applicable to Android only) |
| enableOpacity | boolean | (optional) Make the camera preview see-through. Ideal for augmented reality uses. Default false (applicable to Android and web only)
| enableZoom | boolean | (optional) Set if you can pinch to zoom. Default false (applicable to the android and ios platforms only)
| Option | values | descriptions |
|------------------------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| position | front \ rear | Show front or rear camera when start the preview. Defaults to front |
| width | number | (optional) The preview width in pixels, default window.screen.width (applicable to the android and ios platforms only) |
| height | number | (optional) The preview height in pixels, default window.screen.height (applicable to the android and ios platforms only) |
| x | number | (optional) The x origin, default 0 (applicable to the android and ios platforms only) |
| y | number | (optional) The y origin, default 0 (applicable to the android and ios platforms only) |
| toBack | boolean | (optional) Brings your html in front of your preview, default false (applicable to the android and ios platforms only) |
| paddingBottom | number | (optional) The preview bottom padding in pixes. Useful to keep the appropriate preview sizes when orientation changes (applicable to the android and ios platforms only) |
| rotateWhenOrientationChanged | boolean | (optional) Rotate preview when orientation changes (applicable to the ios platforms only; default value is true) |
| storeToFile | boolean | (optional) Capture images to a file and return back the file path instead of returning base64 encoded data, default false. |
| disableExifHeaderStripping | boolean | (optional) Disable automatic rotation of the image, and let the browser deal with it, default true (applicable to the android and ios platforms only) |
| enableHighResolution | boolean | (optional) Defaults to false - iOS only - Activate high resolution image capture so that output images are from the highest resolution possible on the device |
| disableAudio | boolean | (optional) Disables audio stream to prevent permission requests, default false. (applicable to web and iOS only) |
| lockAndroidOrientation | boolean | (optional) Locks device orientation when camera is showing, default false. (applicable to Android only) |
| enableOpacity | boolean | (optional) Make the camera preview see-through. Ideal for augmented reality uses. Default false (applicable to Android and web only) |
| enableZoom | boolean | (optional) Set if you can pinch to zoom. Default false (applicable to the android and ios platforms only) |

<!-- <strong>Options:</strong>
All options stated are optional and will default to values here
Expand Down Expand Up @@ -202,13 +202,13 @@ CameraPreview.hide();

### capture(options)

| Option | values | descriptions |
|----------|---------------|----------------------------------------------------------------------|
| quality | number | (optional) The picture quality, 0 - 100, default 85 |
| width | number | (optional) The picture width, default 0 (Device default) |
| height | number | (optional) The picture height, default 0 (Device default) |
| Option | values | descriptions |
|----------------------|---------------|-------------------------------------------------------------------------------------------------|
| quality | number | (optional) The picture quality, 0 - 100, default 85 |
| width | number | (optional) The picture width, best fit respecting the aspect ratio of the device (Android only) |
| height | number | (optional) The picture height, best fit the aspect ratio of the device (Android only) |

<!-- <info>Take the picture. If width and height are not specified or are 0 it will use the defaults. If width and height are specified, it will choose a supported photo size that is closest to width and height specified and has closest aspect ratio to the preview. The argument `quality` defaults to `85` and specifies the quality/compression value: `0=max compression`, `100=max quality`.</info><br/> -->
<!-- <info>Take the picture. If width and height are not specified or are 0 it will use the defaults. If width and height are specified, it will choose a supported photo size that is closest to width and height specified and has closest aspect ratio to the preview (only on Android). The argument `quality` defaults to `85` and specifies the quality/compression value: `0=max compression`, `100=max quality`.</info><br/> -->

```javascript
import { CameraPreviewPictureOptions } from '@capacitor-community/camera-preview';
Expand Down Expand Up @@ -266,7 +266,7 @@ const CameraPreviewFlashMode: CameraPreviewFlashMode = 'torch';
CameraPreview.setFlashMode(cameraPreviewFlashMode);
```

### startRecordVideo(options) ---- ANDROID and iOS only
### startRecordVideo(options) ---- ANDROID only

<info>Start capturing video</info><br/>

Expand All @@ -280,7 +280,7 @@ const cameraPreviewOptions: CameraPreviewOptions = {
CameraPreview.startRecordVideo(cameraPreviewOptions);
```

### stopRecordVideo() ---- ANDROID and iOS only
### stopRecordVideo() ---- ANDROID only

<info>Finish capturing a video. The captured video will be returned as a file path and the video format is .mp4</info><br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,35 +765,19 @@ public void run() {
params.setJpegQuality(quality);
}

if (cameraCurrentlyLocked == Camera.CameraInfo.CAMERA_FACING_FRONT && disableExifHeaderStripping) {
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(cameraCurrentlyLocked, info);
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT && disableExifHeaderStripping) {
Activity activity = getActivity();
int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
int degrees = 0;
switch (rotation) {
case Surface.ROTATION_0:
degrees = 0;
break;
case Surface.ROTATION_90:
degrees = 180;
break;
case Surface.ROTATION_180:
degrees = 270;
break;
case Surface.ROTATION_270:
degrees = 0;
break;
case Surface.ROTATION_0: degrees = 0; break;
case Surface.ROTATION_90: degrees = 90; break;
case Surface.ROTATION_180: degrees = 180; break;
case Surface.ROTATION_270: degrees = 270; break;
}
int orientation;
Camera.CameraInfo info = new Camera.CameraInfo();
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
orientation = (info.orientation + degrees) % 360;
if (degrees != 0) {
orientation = (360 - orientation) % 360;
}
} else {
orientation = (info.orientation - degrees + 360) % 360;
}
params.setRotation(orientation);
params.setRotation((info.orientation + degrees) % 360);
} else {
params.setRotation(mPreview.getDisplayOrientation());
}
Expand Down
Loading