@getyoti/react-face-capture
Advanced tools
Comparing version
# CHANGELOG | ||
## v0.2.0 | ||
### New features | ||
- Add language support fallback | ||
### Fixes | ||
- Fix typos in Spanish, Latin Spanish and Italian localisations | ||
- Fix assets configuration in integrators.md | ||
## v0.1.0 | ||
## New Features | ||
### New Features | ||
- Added image quality prop | ||
- Add image quality prop | ||
- Set JPEG High quality as default image format | ||
@@ -28,3 +39,3 @@ - Add languages support: | ||
## Fixes | ||
### Fixes | ||
@@ -37,2 +48,4 @@ - Fix Manual mode Capture Bug | ||
### New Features | ||
- Update TinyFace image validation values | ||
@@ -39,0 +52,0 @@ - imageType prop with `original | cropped` |
{ | ||
"name": "@getyoti/react-face-capture", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Face capture module to collect picture and data for Yoti AI API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# React Face capture integration | ||
The purpose of this module is to capture a face and return the output image. | ||
## Pre-requisite to adopt the dependency | ||
@@ -50,3 +52,3 @@ | ||
**Assets** are not included in the javascript bundle. To have the components to work correctly, you will need to copy library assets from `@getyoti/react-face-capture/assets` folder into your distribution folder assets. | ||
**Assets** are not included in the javascript bundle. To have the components to work correctly, you will need to copy library assets from `@getyoti/react-face-capture/assets` folder into your assets folder. | ||
@@ -58,4 +60,4 @@ For instance, in webpack you can use the plugin `copy-webpack-plugin` in the following way: | ||
{ | ||
from: path.resolve(__dirname, './node_modules/@getyoti/react-face-capture/dist/assets'), | ||
to: path.resolve(__dirname, './dist/assets') | ||
from: path.resolve(__dirname, './node_modules/@getyoti/react-face-capture/assets'), | ||
to: path.resolve(__dirname, './assets') | ||
} | ||
@@ -65,19 +67,19 @@ ]), | ||
## Component API contract | ||
## Props | ||
| Property name | Type | Default | Mand | Description | | ||
| -------------------- | -------------------------- | ---------- | ---- | -------------------------------------------------------------------------------------------------------------------- | | ||
| captureMethod | String `manual/auto` | `manual` | - | The way you capture the photo, either with the button of auto-capture | | ||
| onSuccess | Function({ image }) | - | Y | Callback which will be called once the result (capture) is complete | | ||
| onError | Function | - | - | Callback which will be called when there is an error. See Appendix for the list of error codes we currently support. | | ||
| showOverlay | Boolean | `true` | - | Use a face overlay | | ||
| widthMinConstraint | Number | `1024` | - | Video min width constraint passed to `getUserMedia` | | ||
| widthIdealConstraint | Number | `1280` | - | Video ideal width constraint passed to `getUserMedia` | | ||
| format | String | `jpeg` | - | Image format | | ||
| CustomButton | Function | see Zeplin | - | Custom UI of the button. It uses `onClick` and `disabled` as props | | ||
| countdownMode | String `auto/never/always` | `never` | - | Note: `auto` means it will be hidden on mobile and shown on desktop | | ||
| imageType | String `original/cropped` | `original` | - | Cropped image to improve performance on processing from the API | | ||
| isDebug | Boolean | false | - | If `true`, display useful information | | ||
| qualityType | String `high/medium/low` | `high` | - | The quality of the image taken for jpeg format only. High (1) - Medium (0.96) - Low (0.90) | | ||
| language | Language code (\*) | `en` | - | The language code to set the language of the feedback messages | | ||
| Property name | Type | Default | Mand | Description | | ||
| -------------------- | -------------------------- | ------------- | ---- | -------------------------------------------------------------------------------------------------------------------- | | ||
| captureMethod | String `manual/auto` | `manual` | - | The way you capture the photo, either with the button of auto-capture | | ||
| onSuccess | Function({ image }) | - | Y | Callback which will be called once the result (capture) is complete | | ||
| onError | Function | - | - | Callback which will be called when there is an error. See Appendix for the list of error codes we currently support. | | ||
| showOverlay | Boolean | `true` | - | Use a face overlay | | ||
| widthMinConstraint | Number | `1024` | - | Video min width constraint passed to `getUserMedia` | | ||
| widthIdealConstraint | Number | `1280` | - | Video ideal width constraint passed to `getUserMedia` | | ||
| format | String | `jpeg` | - | Image format | | ||
| CustomButton | Function | simple button | - | Custom UI of the button. It uses `onClick` and `disabled` as props | | ||
| countdownMode | String `auto/never/always` | `never` | - | Note: `auto` means it will be hidden on mobile and shown on desktop | | ||
| imageType | String `original/cropped` | `original` | - | Cropped image to improve performance on processing from the API | | ||
| isDebug | Boolean | false | - | If `true`, display useful information | | ||
| qualityType | String `high/medium/low` | `high` | - | The quality of the image taken for jpeg format only. High (1) - Medium (0.96) - Low (0.90) | | ||
| language | Language code (\*) | `en` | - | The language code to set the language of the feedback messages | | ||
@@ -94,2 +96,10 @@ **(\*)** | ||
### Language fallback | ||
Mechanisnm used for the prop `language` to avoid issues when the value passed is wrong. Example: first try exact match (es-es or es-ES, ignore case): | ||
- If no match, try the mainstream (es), by removing the region part (-es). | ||
- If no mainstream, try any other available es-[region] sibling (example: es-419). | ||
- If no regional sibling, use the default language: en. | ||
### Supported error codes | ||
@@ -101,3 +111,3 @@ | ||
| `GENERIC_CAMERA_ERROR` | Other camera error. The reasons can be [various](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia), and inconsistent across browsers. The complete error is logged in the user’s browser console. | | ||
| `UNSUPPORTED_BROWSER` | The user’s browser is not supported, because the API needed for camera interaction is missing. `Note: Non-Safari browser on iOS also fall into this category.` | | ||
| `UNSUPPORTED_BROWSER` | The user’s browser is not supported, because the API needed for camera interaction is missing. `Note: Older Non-Safari browsers on iOS also fall into this category.` | | ||
| `NO_CAMERA_PERMISSION` | The user rejected the camera permission | | ||
@@ -104,0 +114,0 @@ | `OVERCONSTRAINED` | The camera constraints are not compatible with any camera device. `Note: One recovery option is to lower the widthMinConstraint value.` | |
Sorry, the diff of this file is too big to display
959892
0.15%126
8.62%