Blog

Webcam Photo Component

by on October 19, 2022

Webcam Photo UI Component

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.

Webcam Photo component example

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!

Read the full documentation here.

How to Install the Webcam Photo Component

Installing custom components from Backendless Marketplace is super easy. First, in UI Builder, select the Components tab.

Go to Components in UI Builder

There, you will see a button labeled Install Component. This will take you to the library of components available in the Marketplace.

Install UI Component in UI Builder

When you click Install Component, you will open a list of available UI Components to install.

Install UI Component in UI Builder

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.

Webcam Photo Component added to UI Builder Canvas

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.

Webcam Photo requesting camera access

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.

Select Webcam Photo component event handlers

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 for free today to get access to the full library of UI components, plus the most powerful Codeless backend available. What are you waiting for?

1 Comment

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?

Leave a Reply