SOLVED: cameraControlDo doesn't work on Android

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
simon.schvartzman
Posts: 135
Joined: Tue Jul 29, 2014 12:52 am

SOLVED: cameraControlDo doesn't work on Android

Post by simon.schvartzman » Sat Aug 05, 2017 9:50 pm

Hi, the code below (attached) works fine on iPhone but it doesn't on Android

I've tried with a device running Android 5.1.1 and another with Android 4.4.2 none of them load the picture.

What could be wrong?

Code: Select all

on mouseUp
         -- set the virtual camera
      cameraControlCreate"myFirstCamera"
      cameraControlSet "myFirstCamera", "device", "front"
      -- give time for the camera to settle
      wait for 3 seconds
      -- take the picture 
      cameraControlDo "myFirstCamera", "takePicture" 
      --answer the result
      put the result into img "Img1" 
      set the visible of img "Img1" to true
end mouseUp
Thanks
Attachments
VirtualCamera.livecode.zip
(1.86 KiB) Downloaded 14 times
Last edited by simon.schvartzman on Sun Aug 06, 2017 4:25 pm, edited 1 time in total.
Simon

LiveCode_Panos
Posts: 304
Joined: Fri Feb 06, 2015 4:03 pm

Re: cameraControlDo doesn't work on Android

Post by LiveCode_Panos » Sun Aug 06, 2017 1:36 pm

Hi Simon,

Have you checked the "Camera" permission is the Android Standalone Settings for the stack?

Best,
Panos
--

simon.schvartzman
Posts: 135
Joined: Tue Jul 29, 2014 12:52 am

Re: cameraControlDo doesn't work on Android

Post by simon.schvartzman » Sun Aug 06, 2017 1:53 pm

Hi Panos, yes I had but it makes no difference:
panel.jpeg
Any other suggestion?
Simon

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3926
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: cameraControlDo doesn't work on Android

Post by jacque » Sun Aug 06, 2017 3:56 pm

Camera is selected in the requirements for the device but it also needs to be selected in the permissions section at the bottom.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

simon.schvartzman
Posts: 135
Joined: Tue Jul 29, 2014 12:52 am

Re: cameraControlDo doesn't work on Android

Post by simon.schvartzman » Sun Aug 06, 2017 4:25 pm

Bingo! Many thanks Jacque you made my Sunday!
Simon

simon.schvartzman
Posts: 135
Joined: Tue Jul 29, 2014 12:52 am

Re: SOLVED: cameraControlDo doesn't work on Android

Post by simon.schvartzman » Sun Aug 06, 2017 5:56 pm

For the sake of future users interested in the subject, besides Jacque's hint there is another trick needed to make the code above work on Android.

The "rect" settings of the camera have to be defined before taking the picture (on iPhone there is no such need according to my tests).

The final code will be:

Code: Select all

on mouseUp
   -- set the virtual camera
   cameraControlCreate"myFirstCamera"
   cameraControlSet "MyFirstCamera", "rect", "0,0,0,0"   -- it seems necessary on Android, on iPhone doesn't
   cameraControlSet "myFirstCamera", "device", "front"
   -- give time for the camera to settle
   wait for 3 seconds
   -- take the picture 
   cameraControlDo "myFirstCamera", "takePicture" 
   --answer the result
   put the result into img "Img1" 
   set the visible of img "Img1" to true
end mouseUp
Simon

Post Reply

Return to “Talking LiveCode”