Camera Doesn't return control to LC

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Camera Doesn't return control to LC

Post by trags3 » Mon Jul 01, 2019 7:34 pm

Hello All,
I am trying to have my app allow the user to take a picture.
I have a button called "Take Picture"
Following the code in the dictionary the code for this button is:

on mouseUp
cameraControlCreate "myCamera"
cameraControlSet "myCamera", "rect", (20, 25, 418, 600)
cameraControlSet "myCamera", "visible", "true"
cameraControlSet "myCamera", "device", "back"

mobilePicPhoto "myCamera", 212,122
end mouseUp
Once the Camera is launched the image from the camera is on the screen (live). The Camera controls never show up and therefore an image is never taken. I can navigate to other cards but the camera image is always on the screen.
Help Please,
Tom

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Camera Doesn't return control to LC

Post by Klaus » Mon Jul 01, 2019 7:52 pm

Hi Tom,

looks like you are mixing two different commands -> mobilepickphot and cameracontrol
So you either use cameracontrol throughout:

Code: Select all

...
cameraControlCreate "myCamera"
cameraControlSet "myCamera", "rect", (20, 25, 418, 600)
cameraControlSet "myCamera", "visible", "true"
cameraControlSet "myCamera", "device", "back"
## !!
cameraControlDo "myCamera","takepicture"
put the result into img "your image control here"
cameracontroldelete "myCamera"
...
Or just use mobilepickphoto:

Code: Select all

...
mobilePickPhoto "front camera",400,400
...
Best

Klaus

trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: Camera Doesn't return control to LC

Post by trags3 » Mon Jul 01, 2019 10:06 pm

Thanks Klaus!
Tom

yunior.portilla
Posts: 28
Joined: Sat May 30, 2020 12:50 am

Re: Camera Doesn't return control to LC

Post by yunior.portilla » Thu Jun 25, 2020 6:28 pm

I am happy to share that I was able to get a snapshot of the camera using cameraControl. It really took a bit of work because the example in the help gave me an error ...

After reading a lot, I realized that the file extension should be jpeg, and that using binfile it saved the image well. The other detail is that even though cameraControlDo "myFirstCamera", "takePicture" is used, you must set "videoDevice" and "audioDevice "

I leave you the example here that is working perfectly for me.

These tests are carried out on Android, I suppose the problem is solved because the same thing was happening to me.
Attachments
cameraControl.zip
(1.58 KiB) Downloaded 184 times

Post Reply

Return to “iOS Deployment”