capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

@capacitor/camera take multiple photos via the camera in one session

Open luke-rogers opened this issue 2 years ago • 10 comments

Feature Request

Plugin

Camera

Description

Support for taking multiple photos using the camera without having to reopen the camera each time.

Example real-world use case: An inspector who may need to capture photos of an issue from multiple angles.

Platform(s)

  • iOS
  • Android

Preferred Solution

A new method for the camera plugin (e.g. takePhotos) which allows the user to continue taking photos until they confirm they are finished. At which point, Photo[] is returned by the plugin.

Alternatives

Additional Context

Seems like this functionality is available in the cordova-plugin-media-capture captureImage method

luke-rogers avatar May 24 '23 15:05 luke-rogers

This would be great to have. 👍

chriscarruthers avatar Jul 13 '23 02:07 chriscarruthers

I've been working on this, specifically the Android side. I've made significant progress, but there are some things I'm wondering about.

I noticed that the capacitor-plugins seem to not use layout XML and instead use only code (programmatic) UI layouts.

❓Is there a reason that the project does not use the layout XML?

I ask because in order to support multiple photos, the Android camera plugin will need to use a custom view. Currently the plugin calls the native device camera using an Intent; this approach only allows a single picture at a time.


This leads me to another question:

❓Is the project opposed to using Jetpack Compose?

Jetpack Compose is supposed to be the "new modern" way to do UI for Android.


Finally, last question:

❓Would the project accept contributions to the camera plugin that use Kotlin code?

I have been working in Java only so far, but there are some niceties about Kotlin, so I'm just wondering.

Thanks!

isbecker avatar Jan 24 '24 22:01 isbecker

Here is a demo video of my work on the multi photo mode.

https://github.com/ionic-team/capacitor-plugins/assets/600561/79655986-661d-4586-b05a-6c5c4bebd29d

I think that it is feature complete. There may be a few more tweaks that I need to make.

Features

  • Tap to Focus
  • Pinch to Zoom
  • Zoom buttons
  • Flash: On / Off / Auto
  • Flip to front-facing: not in this demo video (sorry :disappointed: I can add a video if requested)
  • Cancel
  • Done: returns the photos to the app that called the plugin

Next steps

I am working on getting the changes into my fork. I will have that done sometime in the next few days.

iOS

This work in the demo is only for Android.

Getting the same done for iOS will require me to figure out how to setup XCode and I am on Linux and don't have any iOS devices.

isbecker avatar Jan 27 '24 01:01 isbecker

@isbecker any way to use your fork?

blahblehblah avatar Apr 21 '24 18:04 blahblehblah

Hi @blahblehblah, I think that you should be able to add something like the following to your package.json

"dependencies": {
  "@capacitor/camera": "github:isbecker/capacitor-plugins:camera"
}

isbecker avatar Apr 22 '24 01:04 isbecker

Sorry to bump, but any update on this for iOS too?

nicholaszuccarelli avatar Aug 23 '24 05:08 nicholaszuccarelli

Hi @isbecker , could you merge your progress in your fork?

raul-ruiz-gallardo avatar Aug 27 '24 08:08 raul-ruiz-gallardo