UNPKG

veryfi-lens-sdk

Version:

Veryfi Lens web sdk

23 lines 1.02 kB
1. Import package 2. Add id='veryfi-container' to container you want lens to appear 3. Add id='blur-detector' to edit screen if you want to use it's logic 4. Create following function ``` const startLens = async () => { veryfiLens.setUserAgent(navigator.userAgent); //might not be needed if navigator is availible before the sdk veryfiLens.setLocation('US') // 'US' or 'Brazil' to choose servers veryfiLens.init(sessionToken); veryfiLens.startCamera(); intervalRef = window.setInterval(() => { setSocketStatusColor(veryfiLens.getSocketStatusColor()); //if you want to see socket status }, INTERVAL); }; ``` 5. Call it 6. Use the following on capture button ``` const takePhoto = () => { veryfiLens.capture(setImage, setIsEditing); }; where setImage is a setter for cropped image that you will use further and setIsEdiditing is a setter for isEditing that would typically be used to change from camera screen to editing(screen with cropped image) ```