cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bjarvis
Level: Powered On

Camera Capture Button - Camera control not selected

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?

 

 

Capture.PNG

14 REPLIES 14
Community Support Team
Community Support Team

Re: Camera Capture Button - Camera control not selected

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

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BrianHFASPS
Level 8

Re: Camera Capture Button - Camera control not selected

Any update on this? Making a button take picture without user clicking on photo box? Also anyway to disable click sound?

PowerApps Staff mobaky
PowerApps Staff

Re: Camera Capture Button - Camera control not selected

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 Smiley Happy

BrianHFASPS
Level 8

Re: Camera Capture Button - Camera control not selected

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?

BrianHFASPS
Level 8

Re: Camera Capture Button - Camera control not selected

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.

PowerApps Staff mobaky
PowerApps Staff

Re: Camera Capture Button - Camera control not selected

@BrianHFASPS That's interesting! I didn't know that the output was different. I am glad it worked for you!

Highlighted
BrianHFASPS
Level 8

Re: Camera Capture Button - Camera control not selected

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.

jhall
Level 8

Re: Camera Capture Button - Camera control not selected

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:

  • Setting OnSelect for Camera1 to ClearCollect(myPhoto,Camera1.Photo) works
    • First(myPhoto).Url shows data/image
  • Setting OnSelect for Button1 to same as above does not work (unless you first select the Camera1 control as noted above)
    • First(myPhoto).Url shows blank
    • CountRows(myPhoto) returns 1
  • Setting OnEnd for Timer1 does not work unless you have Camera1 selected before the Timer expires
    • First(myPhoto).Url shows blank
    • CountRows(myPhoto) returns 1

We could work around this if there was an ability to programatically control TabIndex and/or force selection of a control.

Super User
Super User

Re: Camera Capture Button - Camera control not selected

@jhall 

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).

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 372 members 4,639 guests
Please welcome our newest community members: