Hi all,
Most tutorials for the Camera Control have you use the Camera Controls 'OnSelect' - which means you're tapping the screen to take the photo.
I would much rather have a 'Capture' button at the bottom of the screen to actually capture the photo
However, it seems that to do this the camera control must be selected first, and re-selected after every press of the button 'Capture' (otherwise the image doesn't capture)
Currently i have a button called 'Capture' that has this code in it's On Select (image attached)
Collect(local_photos, Camera.Photo); UpdateContext({PhotoDateTime: Now()})
Is there anything i can do to make sure the camera control is selected when a user presses the button?
Thanks for the feedback.
Confirmed that the camera would need to be pressed before the Capture button could save the photo property.
To workaorund this, please take a try to use a variable to remind user to press Camera control first before press the Capture button, formula under OnSelect of Capture Button should be:
If(CameraPressed, Collect(MyData, {MyPic:Camera1.Photo,Date:Now()});UpdateContext({PhotoDateTime:Now(),CameraPressed:false}),UpdateContext({Message: "Please tab Camera first"}))
Formula under Camera OnSelect property:
UpdateContext({CameraPressed:true})
Add a Label control, change its text property as:
If(!CameraPressed,Message)
Color proeprty:
RGBA(255,0,0,1)
Regards,
Michael
Any update on this? Making a button take picture without user clicking on photo box? Also anyway to disable click sound?
Hello @BrianHFASPS,
I believe that you can achieve this by using the camera stream. Here is a link to a blog post that shows how to use it:
https://powerapps.microsoft.com/en-us/blog/ux-patterns-camera-shutter-button/
Also capturing images using this method shouldn't make any shutter sounds.
I hope this helps 🙂
Thanks that works great. My problem is how to take the Stream image and use it to save. I am trying to upload to SQL Image column. If I do Camera.Photo via patch to that column it works but Camera.Stream doesn't. I I feed the Camera.Stream into a Collection and view it via gallery I can see it is working. Just not sure why it won't go into SQL. Is the Stream format different than Photo?
The stream is text data only not Image it seems. I was able to patch into VARCHARMAX column type. Then PowerApps can read that back in as Image fine.
@BrianHFASPS That's interesting! I didn't know that the output was different. I am glad it worked for you!
In case anyone else comes accross this I would recommend https://www.youtube.com/watch?v=qX3i8456YwU as it goes into the difference between image and varcharmax in Photo, Pen and Image upload. Also performance differences.
Same problem here. I was trying to do this w/ a timer. For example, pop up the camera on-screen, then start a countdown (e.g. 5...4...3...2...1) to then take a photo.
The curious issue on this of course is that no error is thrown, and the Collection is populated with a single record in all scenarios below (with blank values for the .URL).
So:
We could work around this if there was an ability to programatically control TabIndex and/or force selection of a control.
Not seeing the issue here. I duplicated what you had explained - a Camera control and a timer. I also put a Gallery tied to a collection which had an image control in it. Timer set to repeat every 2 seconds. Stream rate on Camera to 100.
OnTimerEnd - Collect(photoCol, Camera1.Stream)
Every 2 seconds a new row shows up in the gallery. Didn't need to select the camera control or anything. The only interaction was to start the timer (the timer itself).