Skip to main content

Selfie


The "Selfie" widget provides users with access to the front-facing camera on their device, allowing them to quickly capture a selfie photo. It is ideally used in scenarios where user identity verification is necessary, such as during the authentication or registration process.

Furthermore, the widget includes a few quality control parameters designed to ensure that the captured photo meets specific standards. They are as follows:

  • Checks to verify that the background is plain.
  • Checks to ensure that the captured face is clear and well-lit.
  • Checks to determine that the camera doesn't register more than one face within its frame.

On failing to meet any of these requirements, an appropriate "Error" message is thrown.

Selfie

Selfie Properties

PropertyDescription
Use External API
[Checkbox]
Enables you to initiate the "Take", "Retake", "Use", and "Delete" interactions via a custom button click.
TextSets the text that's displayed under the selfie icon.
Align
(Left/Center/Right)
Sets the alignment.
Button LabelChanges the "Text" overlay on the "Take Selfie" Button.
Button Font SizeChanges the font size of the text (under the selfie icon).
Button HeightSets the height of the button.
Button WidthSets the width of the button.
Button Background ColorChanges the background color of the button.
Button Font ColorChanges the font color of the "Text" overlay on the button.
Button Border RadiusSets the border "curve" radius of the button.
Button Border ColorChanges the border color of the button.
Border ShadowAdds a shadow to the border.
Button Alignment
(Top/Center/Bottom)
Sets the alignment of the button.

Selfie Configuration

ConfigurationDescriptionValue (Default)
vishwamDomainUrlThe URL (or API endpoint) enables access to the device's camera hardware.
(To obtain your custom URL, contact the respective API provider.)
https://a8-staging.vishwamcorp.com
vishwamAppIdThe App ID authenticates the API request and ensures that it comes from a trusted source.autonom8

Using the Selfie

Step 1Step 2
Click the "Selfie" icon.

Selfie
If prompted with a notification (on the browser) requesting access to the device's camera, select "Allow".

Selfie

Note: This will grant the necessary permissions for the application to use the device's camera hardware.
Step 3Step 4
Wait for a few seconds for the camera to initializeSelfieOn initiating, the camera should initiate and be viewable on the app - your selfie frame will be bordered by a red/green highlight.

Red - States that the camera is "connected", but the picture isn't focused or clear. (Adjust the camera/angle until the highlight turns green.)

Green - Indicates that the camera is focused and ready for you to click the selfie.
Selfie

Once green, click on the "Take Selfie" (or the respective button) to capture the picture, which then displays the appropriate options.

[Note: The button's size, color, and font are set in the properties panel.]
Step 5Step 6
If the picture you captured does not meet the requirements, an error message (with the appropriate reason) will be displayed along with two buttons - "Cancel" and "Retake".

Selfie
Click the "Retake" button to reopen the camera widget. Or click the "Cancel" button to close the widget without saving any changes.

(OR)

If the captured picture is clear, focused, and with a plain background, you will see two buttons - "Retake" and "Use This".

Selfie
Click the "Retake" button to get back to the capture mode; else, click the "Use This" button to confirm your picture.
Selfie
After you confirm the picture, a preview of it will be displayed on the app.
It includes a "Remove" button, which will allow you to retake the selfie if necessary.
Accessing the camera via a link/QR code.

If either - the widget hasn't detected the camera or you haven't allowed access to it, you will receive "two" options to proceed further:

Selfie

1) Show QR - Displays a QR code that, when scanned, opens the selfie widget on the respective/specific device.

2) Send Link - Displays a link that can be shared to a device with access to a camera. The selfie process can then be initiated on that device.


API Methods

takeSelfie

Initiates the selfie click.

takeSelfie(condition: string): void

reTake

Returns to the camera mode.

reTake(condition: string): void

useThis

To confirm the selected picture.

useThis(condition: string): void

delete

To delete the selected picture.

delete(condition: string): void

setVisibility

Sets the Visibility flag for this component.

setVisibility(visible: boolean): void

setVisibilityCondition

Sets the visibility condition for this component.

setVisibilityCondition(condition: string): void

Event Handlers

onCapture

onCapture - Sets the action to be performed when the "Capture" button is clicked.

onCameraDetect

onCameraDetect - Sets the action to be performed when the camera is (or isn't) detected.