|
19 | 19 | - [4.4 Update your iOS configuration files](#44-update-your-ios-configuration-files) |
20 | 20 | - [Enabling NFC extraction](#enabling-nfc-extraction) |
21 | 21 | - [Usage](#usage) |
22 | | - - [User data](#user-data) |
23 | 22 | - [1. Creating the SDK configuration](#1-creating-the-sdk-configuration) |
24 | 23 | - [2. Parameter details](#2-parameter-details) |
25 | 24 | - [3. Success Response](#3-success-response) |
26 | 25 | - [4. Failure Response](#4-failure-response) |
27 | 26 | - [5. Localization](#5-localization) |
28 | 27 | - [Android](#android) |
29 | 28 | - [iOS](#ios) |
| 29 | +- [Media Callbacks](#media-callbacks) |
| 30 | + - [Introduction](#introduction) |
| 31 | + - [Implementation](#implementation) |
| 32 | + - [User data](#user-data) |
30 | 33 | - [Creating checks](#creating-checks) |
31 | 34 | - [1. Obtaining an API token](#1-obtaining-an-api-token-1) |
32 | 35 | - [2. Creating a check](#2-creating-a-check) |
@@ -341,73 +344,6 @@ export default class App extends Component { |
341 | 344 | ); |
342 | 345 | } |
343 | 346 | } |
344 | | - |
345 | | -### Media Callbacks (beta) |
346 | | - |
347 | | -### Introduction |
348 | | -Onfido provides the possibility to integrate with our Smart Capture SDK, without the requirement of using this data only through the Onfido API. Media callbacks enable you to control the end user data collected by the SDK after the end user has submitted their captured media. As a result, you can leverage Onfido’s advanced on-device technology, including image quality validations, while still being able to handle end users’ data directly. This unlocks additional use cases, including compliance requirements and multi-vendor configurations, that require this additional flexibility. |
349 | | - |
350 | | -**This feature must be enabled for your account.** Please contact your Onfido Solution Engineer or Customer Success Manager. |
351 | | - |
352 | | -### Implementation |
353 | | -To use this feature, use `Onfido.addCustomMediaCallback` and provide the callback. |
354 | | - |
355 | | -```javascript |
356 | | -Onfido.addCustomMediaCallback( |
357 | | - mediaResult => { |
358 | | - if (mediaResult.captureType === 'DOCUMENT') { |
359 | | - // Callback code here |
360 | | - } else if (mediaResult.captureType === 'FACE') { |
361 | | - // Callback code here |
362 | | - } else if (mediaResult.captureType === 'VIDEO') { |
363 | | - // Callback code here |
364 | | - } |
365 | | - } |
366 | | -); |
367 | | -``` |
368 | | - |
369 | | -### User data |
370 | | -The callbacks return an object including the information that the SDK normally sends directly to Onfido. The callbacks are invoked when the end user confirms submission of their image through the SDK’s user interface. |
371 | | - |
372 | | -**Note:** Currently, end user data will still automatically be sent to the Onfido backend, but you are not required to use Onfido to process this data. |
373 | | - |
374 | | -The callback returns 3 possible objects. Please note, `captureType` refers to the type of the media capture in each case. |
375 | | -These can be `DOCUMENT`, `FACE` or `VIDEO`. |
376 | | - |
377 | | -1. For documents(`captureType` is `DOCUMENT`), the callback returns: |
378 | | -```json5 |
379 | | - { |
380 | | - captureType: String |
381 | | - side: String |
382 | | - type: String |
383 | | - issuingCountry: String? |
384 | | - fileData: Data |
385 | | - fileName: String |
386 | | - fileType: String |
387 | | - } |
388 | | -``` |
389 | | - |
390 | | -**Note:** `issuingCountry` is optional based on end-user selection, and can be `null`. |
391 | | -**Note:** If a document was scanned using NFC, the callback will return the passport photo in `file` but no additional data. |
392 | | - |
393 | | -2. For live photos (`captureType` is `FACE`), the callback returns: |
394 | | -```json5 |
395 | | -{ |
396 | | - captureType: String |
397 | | - fileData: Data |
398 | | - fileName: String |
399 | | - fileType: String |
400 | | -} |
401 | | -``` |
402 | | - |
403 | | -3. For videos(`captureType` is `VIDEO`), the callback returns: |
404 | | -```json5 |
405 | | -{ |
406 | | - captureType: String |
407 | | - fileData: Data |
408 | | - fileName: String |
409 | | - fileType: String |
410 | | -} |
411 | 347 | ``` |
412 | 348 |
|
413 | 349 | ### 1. Creating the SDK configuration |
@@ -457,7 +393,9 @@ config = { |
457 | 393 | * Valid values in `OnfidoFaceSelfieCapture`: `type`: OnfidoCaptureType.PHOTO |
458 | 394 | * Valid values in `OnfidoFaceVideoCapture`: `type`: OnfidoCaptureType.VIDEO |
459 | 395 |
|
460 | | - **Note**: In the scenario that the Motion variant is not supported on the user's device, if you configure the `motionCaptureFallback` appropriately it will allow the user to capture a Selfie or a Video as a fallback. |
| 396 | + In the scenario that the Motion variant is not supported on the user's device, if you configure the `motionCaptureFallback` appropriately it will allow the user to capture a Selfie or a Video as a fallback. |
| 397 | + |
| 398 | + **Note**: Fallback is not used in Android anymore as Motion is supported in all devices and OS versions specified by the SDK. |
461 | 399 | * **`recordAudio`**: Required if captureFace is specified as MOTION. |
462 | 400 | * Valid values: `true`, `false` |
463 | 401 | * **`localisation`**: Optional. This object contains localisation configuration. See section [Localization](#localization) for the details. |
@@ -584,6 +522,84 @@ localisation: { |
584 | 522 | 3. Follow the instructions for [iOS Localisation](https://medium.com/lean-localization/ios-localization-tutorial-938231f9f881) to add a new custom language or override existing translations. |
585 | 523 | 4. You can find the keys that need to be translated in the [iOS SDK repo](https://github.com/onfido/onfido-ios-sdk/blob/master/localization/Localizable_EN.strings). |
586 | 524 |
|
| 525 | +## Media Callbacks |
| 526 | + |
| 527 | +### Introduction |
| 528 | +Onfido provides the possibility to integrate with our Smart Capture SDK, without the requirement of using this data only through the Onfido API. Media callbacks enable you to control the end user data collected by the SDK after the end user has submitted their captured media. As a result, you can leverage Onfido’s advanced on-device technology, including image quality validations, while still being able to handle end users’ data directly. This unlocks additional use cases, including compliance requirements and multi-vendor configurations, that require this additional flexibility. |
| 529 | + |
| 530 | +**This feature must be enabled for your account.** Please contact your Onfido Solution Engineer or Customer Success Manager. |
| 531 | + |
| 532 | +### Implementation |
| 533 | +To use this feature, use `Onfido.addCustomMediaCallback` and provide the callback. |
| 534 | + |
| 535 | +```javascript |
| 536 | +Onfido.addCustomMediaCallback( |
| 537 | + mediaResult => { |
| 538 | + if (mediaResult.captureType === 'DOCUMENT') { |
| 539 | + // Callback code here |
| 540 | + } else if (mediaResult.captureType === 'FACE') { |
| 541 | + // Callback code here |
| 542 | + } else if (mediaResult.captureType === 'VIDEO') { |
| 543 | + // Callback code here |
| 544 | + } |
| 545 | + } |
| 546 | +); |
| 547 | +``` |
| 548 | + |
| 549 | +### User data |
| 550 | +The callbacks return an object including the information that the SDK normally sends directly to Onfido. The callbacks are invoked when the end user confirms submission of their image through the SDK’s user interface. |
| 551 | + |
| 552 | +**Note:** Currently, end user data will still automatically be sent to the Onfido backend, but you are not required to use Onfido to process this data. |
| 553 | + |
| 554 | +The callback returns 3 possible objects. Please note that `captureType` refers to the type of the media capture in each case. |
| 555 | +These can be `DOCUMENT`, `FACE` or `VIDEO`. |
| 556 | + |
| 557 | +1. For documents (`captureType` is `DOCUMENT`), the callback returns: |
| 558 | +```json5 |
| 559 | +{ |
| 560 | + captureType: String |
| 561 | + side: String |
| 562 | + type: String |
| 563 | + issuingCountry: String? |
| 564 | + fileData: String |
| 565 | + fileName: String |
| 566 | + fileType: String |
| 567 | +} |
| 568 | +``` |
| 569 | + |
| 570 | +**Notes:** |
| 571 | +- `issuingCountry` is optional based on end-user selection, and can be `null`. |
| 572 | +- `fileData` is a String representation of the byte array data corresponding to the captured photo of the document. |
| 573 | +- If a document was scanned using NFC, the callback will return the passport photo in `fileData` but no additional data. |
| 574 | + |
| 575 | +2. For live photos (`captureType` is `FACE`), the callback returns: |
| 576 | +```json5 |
| 577 | +{ |
| 578 | + captureType: String |
| 579 | + fileData: String |
| 580 | + fileName: String |
| 581 | + fileType: String |
| 582 | +} |
| 583 | +``` |
| 584 | +**Note:** `fileData` is a String representation of the byte array data corresponding to the captured live photo. |
| 585 | + |
| 586 | +3. For videos(`captureType` is `VIDEO`), the callback returns: |
| 587 | +```json5 |
| 588 | +{ |
| 589 | + captureType: String |
| 590 | + fileData: String |
| 591 | + fileName: String |
| 592 | + fileType: String |
| 593 | +} |
| 594 | +``` |
| 595 | +**Note:** `fileData` is a String representation of the byte array data corresponding to the captured video. |
| 596 | + |
| 597 | +Please note that, for your convenience, Onfido provides the `byteArrayStringToBase64` helper function to convert the `fileData` from String to a Base64 format. Here is an example of how to use it: |
| 598 | +```javascript |
| 599 | +let byteArrayString = mediaResult.fileData; |
| 600 | +let base64FileData = Onfido.byteArrayStringToBase64(byteArrayString); |
| 601 | +``` |
| 602 | + |
587 | 603 | ## Creating checks |
588 | 604 |
|
589 | 605 | As the SDK is only responsible for capturing and uploading photos/videos, you would need to start a check on your backend server using the [Onfido API](https://documentation.onfido.com/). |
|
0 commit comments