A common basic function in many apps is giving users access to their device’s camera for taking a picture. With the Webcam Photo component, you can easily enable users to take snapshots with their phone, tablet, or webcam camera.
Whether your users will be snapping a selfie to set as their profile pic or taking photos to post to their feed, the Webcam Photo component makes it easy to achieve whatever photo taking functionality you desire.
The Webcam Photo component, available free in Backendless Marketplace, lets you get access to the user’s device’s camera, with the user’s permission. The component works on devices of all kinds, from laptop webcams to cell phone cameras.
In addition to accessing the device’s camera, the component includes an optional Upload button allowing users to upload existing photos from their device.
When used in combination with the new Image Processor API, you can unlock tons of possibilities for implementing user-generated images in your application!
Installing custom components from Backendless Marketplace is super easy. First, in UI Builder, select the Components tab.
There, you will see a button labeled Install Component. This will take you to the library of components available in the Marketplace.
When you click Install Component, you will open a list of available UI Components to install.
Select the component you want and click Install.
When you return to the User Interface tab, you will see a new section added to your toolkit on the right-hand side called Custom Components.
You can then simply drag the component onto your canvas just like any other UI Component.
How the Webcam Photo Component Works
When added to your app, the Webcam Photo component offers several basic functions out of the box.
First and foremost, the component includes logic requesting that the user give the app permission to access their device’s camera. You have the option to customize the text used to make this request, and the text that will display if permission has not been granted.
Next, the component includes two image blocks: one that shows the live camera, and one for the snapshot (you can rename “Snapshot” to match your app’s use case as well).
Alternately, the component includes an Upload button that allows the user to upload an image from their device. You can disable this button or choose not to display it at all if you prefer.
Finally, once the user has taken their snapshot, they will be able to click the Done button, which triggers the On Save Image event, which you can customize with your own logic.
Available Options and What They Mean
Once you have placed your component, when you select it, you will see all of the available options (properties) for the component in the toolkit area. These are the default settings for the component that you can easily adjust.
Each of the available properties are described in the table below. For more information, such as Theme styles and event handlers, visit the Webcam Photo GitHub repo.
Property
Type
Default value
Logic
Data Binding
UI Setting
Description
uploadButtonLabel
text
“Upload”
NO
YES
Controls label on the Upload button.
uploadButtonDisabled
checkbox
false
Upload Button Disabled Logic
YES
YES
Controls if the upload button is disabled.
uploadButtonVisible
checkbox
true
Upload Button Visible Logic
YES
YES
Controls if the upload button is visible.
makePhotoButtonLabel
text
“Make photo”
NO
YES
Controls label on the Make photo button.
makePhoto
ButtonDisabled
checkbox
false
Photo Button Disabled Logic
YES
YES
Controls if the photo button is disabled.
makePhotoButtonVisible
checkbox
true
Photo Button Visible Logic
YES
YES
Controls if the photo button is visible.
makeSnapshot
ButtonLabel
text
“Snapshot”
NO
YES
Controls label on the Make snapshot button.
doneButtonLabel
text
“Done”
NO
YES
Controls label on the Done button.
popupLinkLabel
text
“Info…”
NO
YES
Controls link label in popup.
noYetPermission
PopupTitle
text
“Give access to the camera”
NO
YES
Controls title in popup when the user has not yet allowed the use of the camera.
noYetPermission
PopupDescription
text
“To work properly, you must allow the app to access the camera.”
NO
YES
Controls description in popup when the user has not yet allowed the use of the camera.
noPermissionPopupTitle
text
“No camera access”
NO
YES
Controls title in popup when the user did not allow the use of the camera.
noPermission
PopupDescription
text
“Blocked app access to the camera. Follow the link for detailed information on how to grant access.”
NO
YES
Controls description in popup when the user did not allow the use of the camera.
When you click on the Logic icon or tab for the component, you will see the modifiable event handlers, just as you would with a standard component. However, the main logic for the component – the logic that makes it work – is hidden to protect it from accidentally being broken.
Additionally, in the Logic area, you will also find all available data binding properties.
That’s it! Ready to try it for yourself?
The Webcam Photo component is one of many custom components available now in Backendless Marketplace, completely free!
Start Building Your Perfect UI
Start your free 30-day trial today to get access to the full library of UI components, plus the most powerful Codeless backend available. What are you waiting for?
Sadly, this component doesn’t seem to work — the snapshot and live camera images, along with the “done” button do not actually appear. Must be some bug in there somewhere — anyone else got this component working?
Choosing the best no-code app builder for your project can be a daunting task. In this article, we walk you through the process and highlight some of our favorites.
A snackbar or “toast” element is a message displayed to the user, usually on a temporary basis over a few seconds. It’s great for alerting the user to something without requiring any action. Think of a success message, a confirmation, or an error alert of some kind.
Sadly, this component doesn’t seem to work — the snapshot and live camera images, along with the “done” button do not actually appear. Must be some bug in there somewhere — anyone else got this component working?