cameraControlSet issue

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

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 301
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

cameraControlSet issue

Post by thatkeith » Wed Nov 27, 2019 2:42 pm

I'm refreshing my memory of LC tricks, which often means reminding myself of things by using examples from the LC Dictionary. The code samples provided there are very helpful... except when they don't work as expected – or at all. This is from the cameraControlCreate entry:

Code: Select all

   cameraControlCreate "myFirstCamera"
   cameraControlSet "myFirstCamera", "visible", true
   cameraControlSet "myFirstCamera", "rect", "50,50,500,500"
   cameraControlSet "myFirstCamera", "device", "front"
   cameraControlDo "myFirstCamera", "takePicture"
   put the result into url ("file:" & specialFolderPath("documents") & "/snapshot.jpg")
The cameraControlSet "myFirstCamera", "device", "front" line triggers an 'error in statement' entry in the revErrorDisplay window:

Code: Select all

Type	Handler: error in statement
Object	Button
Line	cameraControlSet "myFirstCamera", "device", "front"
Hint	mouseup
Any suggestions?

Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
360 VR media specialist

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: cameraControlSet issue

Post by [-hh] » Wed Nov 27, 2019 5:58 pm

You probably don't have a front camera available (what cameraControl sees as "front").

Assuming you have any camera (built-in or webcam) attached, are you allowed to access that camera?
What happens if you omit that line?

See also the new version LC 9.6.0-dp1 that "upgraded" cameraControl for some scenarios.

This sample stack has scripts for using up to 2 intern or extern cameras:
(sorry, currently not available)
shiftLock happens

Post Reply

Return to “Talking LiveCode”