-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[camerax] Update README with plugin overview #3891
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
Changes from 15 commits
dec3d69
0e0333b
886e049
cd1f2a7
a86eeed
b7e3cf6
cdf2e67
597f9d7
f862d81
0585bfa
f443d28
e36d363
dfa4173
b54433a
7370a5e
8343829
426f33b
93afe6a
f59896a
d0278e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Contributing to camera\_android\_camerax | ||
|
|
||
| ## Plugin structure | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not a blocker but I think this should start with an overview of the architecture @bparrishMines designed. Maybe linking the design doc or if not that then a 1 paragraph summary describing the structure.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added one! |
||
|
|
||
| The `camera_platform_interface` implementation is located at | ||
| `lib/src/android_camera_camerax.dart`, and it is implemented using Dart classes that | ||
| are wrapped versions of native Android Java classes. | ||
|
|
||
| In `lib/src/`, you will find all of the Dart-wrapped native classes that the plugin | ||
| currently uses in its implementation. Each of these classes uses an `InstanceManager` | ||
| (implementation in `instance_manager.dart`) to manage objects that are created by | ||
| the plugin implementation that map to objects of the same type created on the native | ||
| side. This plugin uses [`pigeon`][1] to generate the communication layer between Flutter | ||
| and native Android code, so each of these Dart-wrapped classes also have Host API and | ||
| Flutter API implementations, as needed. The communication interface is defined in | ||
| the `pigeons/camerax_library.dart` file. After editing the communication interface, | ||
| regenerate the communication layer by running | ||
| `dart run pigeon --input pigeons/camerax_library.dart` from the plugin root. | ||
|
|
||
| On the native side in `android/src/main/java/io/flutter/plugins/camerax/`, you'll | ||
|
||
| find the Host API and Flutter API implementations of the same classes wrapped with | ||
|
||
| Dart in `lib/src/`. These implementations call directly to the classes that they | ||
| are wrapping in the CameraX library or other Android libraries. The objects created | ||
camsim99 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| in the native code map to objects created on the Dart side, and thus, are also | ||
| managed by an `InstanceManager` (implementation in `InstanceManager.java`). | ||
|
|
||
| If you need to access any Android classes to contribute to this plugin, you should | ||
|
||
| search in `lib/src/` for any Dart-wrapped classes you may need. If any classes that | ||
| you need are not wrapped or you need to access any methods not wrapped in a class, | ||
| you must take the additional steps to wrap them to maintain the structure of this plugin. | ||
|
|
||
| For more information on the approach of wrapping native libraries for plugins, please | ||
|
||
| see the [design document][2]. For more information on contributing packages in general, | ||
| check out our [contribution guide][3]. | ||
|
|
||
| ## Testing | ||
reidbaker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Besides [`pigeon`][1], this plugin also uses [`mockito`][4] to generate mock objects for | ||
| testing purposes. To generate the mock objects, run | ||
| `dart run build_runner build --delete-conflicting-outputs`. | ||
|
|
||
|
|
||
| [1]: https://pub.dev/packages/pigeon | ||
| [2]: https://docs.google.com/document/d/1wXB1zNzYhd2SxCu1_BK3qmNWRhonTB6qdv4erdtBQqo/edit?usp=sharing&resourcekey=0-WOBqqOKiO9SARnziBg28pg | ||
| [3]: https://github.com/flutter/packages/blob/main/CONTRIBUTING.md | ||
| [4]: https://pub.dev/packages/mockito | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,64 @@ | ||
| # camera_android_camerax | ||
| # camera\_android\_camerax | ||
|
|
||
| An implementation of the camera plugin on Android using CameraX. | ||
| An Android implementation of [`camera`][1] that uses the [CameraX library][2]. | ||
|
|
||
| *Note*: This package is under development. | ||
reidbaker marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| See [missing features and limitations](#missing-features-and-limitations). | ||
|
|
||
| ## Usage | ||
|
|
||
| This package is [non-endorsed][3]; the endorsed Android implementation of `camera` | ||
| is [`camera_android`][4]. To use this implementation of the plugin instead of | ||
| `camera_android`, you will need to specify it in your `pubsepc.yaml` file as a | ||
| dependency in addition to `camera`: | ||
|
|
||
| ```yaml | ||
| dependencies: | ||
| # ...along with your other dependencies | ||
| camera: ^0.10.4 | ||
| camera_android_camerax: ^0.5.0 | ||
| ``` | ||
|
|
||
| ## Missing features and limitations | ||
|
|
||
| ### Resolution configuration \[[Issue #120462][120462]\] | ||
reidbaker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Any specified `ResolutionPreset` wll go unused in favor of CameraX defaults and | ||
| `onCameraResolutionChanged` is unimplemented. | ||
|
|
||
| ### Locking/Unlocking capture orientation \[[Issue #125915][125915]\] | ||
|
|
||
| `lockCaptureOrientation` & `unLockCaptureOrientation` are unimplemented. | ||
|
|
||
| ### Flash mode configuration \[[Issue #120715][120715]\] | ||
|
|
||
| `setFlashMode` is unimplemented. | ||
|
|
||
| ### Exposure mode, point, & offset configuration \[[Issue #120468][120468]\] | ||
|
|
||
| `setExposureMode`, `setExposurePoint`, & `setExposureOffset` are unimplemented. | ||
|
|
||
| ### Focus mode & point configuration \[[Issue #120467][120467]\] | ||
|
|
||
| `setFocusMode` & `setFocusPoint` are unimplemented. | ||
|
|
||
| ### Zoom configuration \[[Issue #125371][125371]\] | ||
|
|
||
| `setZoomLevel` is unimplemented. | ||
|
|
||
| ## Contributing | ||
|
|
||
| For more information on contributing to this plugin, see [`CONTRIBUTING.md`](CONTRIBUTING.md). | ||
|
|
||
| <!-- Links --> | ||
|
|
||
| [1]: https://pub.dev/packages/camera | ||
| [2]: https://developer.android.com/training/camerax | ||
| [3]: https://docs.flutter.dev/packages-and-plugins/developing-packages#non-endorsed-federated-plugin | ||
| [4]: https://pub.dev/packages/camera_android | ||
| [120462]: https://github.com/flutter/flutter/issues/120462 | ||
| [125915]: https://github.com/flutter/flutter/issues/125915 | ||
| [120715]: https://github.com/flutter/flutter/issues/120715 | ||
| [120468]: https://github.com/flutter/flutter/issues/120468 | ||
| [120467]: https://github.com/flutter/flutter/issues/120467 | ||
| [125371]: https://github.com/flutter/flutter/issues/125371 | ||
Uh oh!
There was an error while loading. Please reload this page.