Image Widget- Automatically or a separate button to capture

I would like to design a form to automatically capture an image when the user clicks a button. The vision camera is the perfect fit but cannot be configured for a tablet device for which the app is designed. The camera widget would be a good fit but requires the user to click the capture button to save the image and then again click the form button.

I tried writing a custom widget in HTML/javascript. The camera powers up but no image is displayed on the screen.

Has anyone faced a similar scenario and had a solution.