Can I replace (or skip) "RETRY / OK" stage of media.capturePhoto?

Hi,

When I use media.capturePhoto, the camera opens, the user takes a picture, and then a picture

is displayed with “RETRY    OK” buttons at the top.  The user taps one of the two buttons.

[The entire interaction after the start of the camera “opening” to just after the user

taps “OK” is not under my control … it’s Corona and/or the native OS]

But… that’s rather limiting.  What if I don’t want “RETRY   OK”? 

I’d like to be able to:

   1. choose to automatically accept any photo they’ve taken (i.e., bypass that RETRY / OK screen)

or

   2. specify my own return/ok buttons.  (In my case, I’d want to have 4 buttons:

            Public, Private, Retry, Cancel

      …the first two accept the photo but mark it (to my app) as “public” or “private”.

(If I did #1, I’d then display the photo and ask: Public / Private / Retake / Cancel)

Yes, I have the same question about iOS, where it displays “Retake     Use Photo” at the bottom.

thanks,

Stan

Apple has pretty strict controls over what you can do with capturing photos, video or getting content from the camera roll. The OS provides the dialog that we have to use. There are very few controls over this dialog and after looking over several documentation and “how to” sites, I don’t see any controls for setting the values of the buttons.

Corona is a cross-platform engine and frequently when we have to do things at the OS level like this, it’s going to be the most common features between the two.

To sum up. This is not currently possible with Corona. This most likely is not possible at all given OS restrictions. If it is possible then it would have to happen pretty deep in very OS specific code, you might be able to do this using Corona Native builds.

Rob

thanks, Rob!

I hoped something might be possible, particularly on Android. 

I saw one Android app that immediately shows a continuous

video stream of what the camera “sees” … it has a “capture” button which works immediately, showing a thumbnail of

the capture while continuing to do the stream.  Of course, it’s probably ‘native’. 

Assuming iOS can do something similar (and I’m fairly sure it can), the labs might consider

if there’s enough interest to add a second form of captureMedia, one which does that stream,

allows an easy photo to be taken and returned immediately without dialog.

Perhaps media.quickCapturePhoto?  (allows user to tap button to take picture)

and media.quickCapturePhotoNow   (immediately takes photo and returns, with no disturbance to display)

There are obvious applications to gaming, of course, for both quick Capture APIs.

thanks again,

Stan

Corona doesn’t implement live video feeds through the media.* API’s. Those are for capturing single instance photos and videos or getting something from a photo album. 

Getting a video feed into your app is done through filling a display object. You can do something like:

 local background = display.newRect( \_W\*0.5, \_H\*0.5, \_W, \_H ) background.fill = { type = "camera" }

But we only support this on iOS. It’s too difficult to implement across Android and we have no plans to add support for this to Android. We want to support this, but it’s simply too difficult.

Rob

@Rob: the video feed concept is great, thanks!  (even if only iOS)

BTW, any chance the media.capturePhoto will mention this? 

It would be nice if things like “display.newRect / fill” doc and “media.capturePhoto” doc pointed to a common “here’s how to get still photo, here’s how to get video” combined discussion page.

thanks,

Stan

@Rob - taking a different tack with this - could the camera be opened and read as a raw device? In the old days, we used to open these using the File APIs. Ie :
local a
local file = io.open(camera, “rb”)
while (a=io.read(file, bufferSize) then
processBuffer(a)
end
io.close(file)

Or some such code

I like the iOS fill solution, but need Android as well. Being able to read the device through file io, would let me roll my own.

Thanks

Dave

Corona does not have those facilities. I’m not sure even with Corona Native how you could get a video fill to a Corona display object.

Rob

I was thinking of reading the raw data, creating a png or jpg, saving it as a temp file and loading with new image rect. I don’t need a super quick refresh.

Dave

Apple has pretty strict controls over what you can do with capturing photos, video or getting content from the camera roll. The OS provides the dialog that we have to use. There are very few controls over this dialog and after looking over several documentation and “how to” sites, I don’t see any controls for setting the values of the buttons.

Corona is a cross-platform engine and frequently when we have to do things at the OS level like this, it’s going to be the most common features between the two.

To sum up. This is not currently possible with Corona. This most likely is not possible at all given OS restrictions. If it is possible then it would have to happen pretty deep in very OS specific code, you might be able to do this using Corona Native builds.

Rob

thanks, Rob!

I hoped something might be possible, particularly on Android. 

I saw one Android app that immediately shows a continuous

video stream of what the camera “sees” … it has a “capture” button which works immediately, showing a thumbnail of

the capture while continuing to do the stream.  Of course, it’s probably ‘native’. 

Assuming iOS can do something similar (and I’m fairly sure it can), the labs might consider

if there’s enough interest to add a second form of captureMedia, one which does that stream,

allows an easy photo to be taken and returned immediately without dialog.

Perhaps media.quickCapturePhoto?  (allows user to tap button to take picture)

and media.quickCapturePhotoNow   (immediately takes photo and returns, with no disturbance to display)

There are obvious applications to gaming, of course, for both quick Capture APIs.

thanks again,

Stan

Corona doesn’t implement live video feeds through the media.* API’s. Those are for capturing single instance photos and videos or getting something from a photo album. 

Getting a video feed into your app is done through filling a display object. You can do something like:

 local background = display.newRect( \_W\*0.5, \_H\*0.5, \_W, \_H ) background.fill = { type = "camera" }

But we only support this on iOS. It’s too difficult to implement across Android and we have no plans to add support for this to Android. We want to support this, but it’s simply too difficult.

Rob

@Rob: the video feed concept is great, thanks!  (even if only iOS)

BTW, any chance the media.capturePhoto will mention this? 

It would be nice if things like “display.newRect / fill” doc and “media.capturePhoto” doc pointed to a common “here’s how to get still photo, here’s how to get video” combined discussion page.

thanks,

Stan

@Rob - taking a different tack with this - could the camera be opened and read as a raw device? In the old days, we used to open these using the File APIs. Ie :
local a
local file = io.open(camera, “rb”)
while (a=io.read(file, bufferSize) then
processBuffer(a)
end
io.close(file)

Or some such code

I like the iOS fill solution, but need Android as well. Being able to read the device through file io, would let me roll my own.

Thanks

Dave

Corona does not have those facilities. I’m not sure even with Corona Native how you could get a video fill to a Corona display object.

Rob

I was thinking of reading the raw data, creating a png or jpg, saving it as a temp file and loading with new image rect. I don’t need a super quick refresh.

Dave