Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Android Camera v2 API #339

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2fc8acc
(build) change: use local plugin version for demo
Mar 7, 2024
b46053d
feat: implement getMaxZoom(), getZoom(), setZoom() for Android and iOS
dpa99c Mar 7, 2024
4f4e6a7
(android) rework: use Camera2 API instead of legacy Camera API
dpa99c Feb 10, 2024
ec762ec
(ios) bugfix: fix calculation of x/y offsets to use hard-coded factor…
dpa99c Jun 10, 2024
5b9d31d
Merge branch 'ios_fix_pixel_ratio'
dpa99c Jun 10, 2024
eb1d400
(android) add support for getMaxZoomLimit(), setMaxZoomLimit(), maxZo…
dpa99c Jun 10, 2024
a9d3a8b
(ios) add support for getMaxZoomLimit(), setMaxZoomLimit(), maxZoomLi…
Jun 10, 2024
49fe26b
Merge branch 'max_zoom_limit'
dpa99c Jun 10, 2024
40c8806
(android) emit JS event when current zoom level changes
dpa99c Jun 10, 2024
b49d9c6
(ios) emit JS event when current zoom level changes
Jun 11, 2024
f73d89e
Merge branch 'events'
dpa99c Jun 11, 2024
5083df6
(android) fix: apply device pixel ratio when calculating optimal prev…
dpa99c Jun 16, 2024
a92d431
(android) fix: apply device pixel ratio when calculating optimal prev…
dpa99c Jun 16, 2024
5a5e47b
bugfix: don't try to restore previous orientation if it wasn't alread…
dpa99c Jun 19, 2024
41bca94
Merge branch 'android_camera_v2'
dpa99c Jun 19, 2024
d0f639e
(android) remove unused imports
dpa99c Jun 22, 2024
cf74a41
(android) enhance robustness with try/catch; code cleanup
dpa99c Jul 12, 2024
a2c6e35
(android) improve robustness of onCreateView
dpa99c Jul 30, 2024
9da391e
(android) fix: ensure all catch statements use generic Exception clas…
dpa99c Aug 12, 2024
70e2de5
(android) Tighten up exception handling.
dpa99c Aug 13, 2024
d2d8954
bump dependencies to capacitor@6
dpa99c Aug 13, 2024
c78740a
(android) send error/log events to JS layer via window object
dpa99c Aug 13, 2024
a368c6f
(android) fix: structure of messages sent to window object as events
dpa99c Aug 13, 2024
8545d42
(android) don't log error/log messages direct to JS console
dpa99c Aug 13, 2024
60e39f4
(android) fix: sanitise log messages sent to JS window object to ensu…
dpa99c Aug 13, 2024
3d8e04d
(android) if lockAndroidOrientation=true, ignore orientation changes …
dpa99c Nov 4, 2024
8fb1799
(android) enhance robustness with try/catch; code cleanup
dpa99c Jul 12, 2024
0b604f8
(android) improve robustness of onCreateView
dpa99c Jul 30, 2024
7fd66ed
(android) fix: ensure all catch statements use generic Exception clas…
dpa99c Aug 12, 2024
31d1a40
(android) Tighten up exception handling.
dpa99c Aug 13, 2024
30442fb
bump dependencies to capacitor@6
dpa99c Aug 13, 2024
de00e2b
(android) send error/log events to JS layer via window object
dpa99c Aug 13, 2024
d10adb7
(android) fix: structure of messages sent to window object as events
dpa99c Aug 13, 2024
a3faeb3
(android) don't log error/log messages direct to JS console
dpa99c Aug 13, 2024
4259020
(android) fix: sanitise log messages sent to JS window object to ensu…
dpa99c Aug 13, 2024
e8a217f
(android) if lockAndroidOrientation=true, ignore orientation changes …
dpa99c Nov 4, 2024
5af4602
feat: Implements getMaxZoom(), getZoom() and setZoom() as per the Cor…
dpa99c Nov 12, 2024
d59b814
Merge branch 'master' into android_camera_v2
dpa99c Nov 12, 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
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Starts the camera preview instance.
| 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)
| maxZoomLimit | number | (optional) Set the max zoom level to limit the camera device to. Set to -1 for unlimited. Default -1 (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 @@ -297,6 +298,51 @@ const myCamera = CameraPreview.start({enableOpacity: true});
myCamera.setOpacity({opacity: 0.4});
```

### getMaxZoom(): Promise<{value: number}>; ---- ANDROID and iOS only

<info>Get the maximum zoom level for the camera device currently started.</info><br/>

```javascript
const myCamera = CameraPreview.start();
const maxZoom = await CameraPreview.getMaxZoom();
```

### getZoom(): Promise<{value: number}>; ---- ANDROID and iOS only

<info>Get the current zoom level for the camera device currently started.</info><br/>

```javascript
const myCamera = CameraPreview.start();
const zoom = await CameraPreview.getZoom();
```

### setZoom({zoom: number}): Promise<void>; ---- ANDROID and iOS only

<info>Set the zoom level for the camera device currently started.</info><br/>

```javascript
const myCamera = CameraPreview.start();
await CameraPreview.setZoom({zoom: 2});
```

### getMaxZoomLimit(): Promise<{value: number}>; ---- ANDROID and iOS only

<info>Gets the current zoom max level which the camera device is limited to. -1 indicates unlimited.</info><br/>

```javascript
const myCamera = CameraPreview.start();
const zoomLimit = await CameraPreview.getMaxZoomLimit();
```

### setMaxZoomLimit({zoom: number}): Promise<void>; ---- ANDROID and iOS only

<info>Sets the max zoom level to limit the camera device to. Set to -1 for unlimited.</info><br/>

```javascript
const myCamera = CameraPreview.start();
await CameraPreview.setMaxZoomLimit({zoom: 5});
```

# Settings

<a name="camera_Settings.FlashMode"></a>
Expand Down
Loading