High Accuracy OCR, Face Recognition & Liveness
  • Language
    • Overview
    • Android
      • Project Setup
      • Accura OCR
      • Accura Face Match
      • Accura Liveness
    • iOS
      • Project Setup
        • Check Pod Size
      • Accura OCR
        • Setup Accura License and Configurations
        • Set Camera View
      • Accura Face Match
      • Accura liveness
    • Flutter
      • Project Setup
      • Android Setup
        • Adding Permissions, Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Installing pods and Adding Permissions.
        • Adding License
      • Functions
        • Fetching Details From License
        • Setting Configurations, Error messages, Camera customization
        • OCR
        • MRZ
        • Barcode and Bankcard
        • Facematch and Liveness
    • Cordova
      • Project Setup
      • Android Setup
        • Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Installing pods
        • Adding License
      • Functions
        • Fetching Details From License
        • Setting Title & Error messages
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • React-Native
      • Project Setup
      • Android Setup
        • Adding Permissions, Packaging options and Auth Token
        • Adding License
      • iOS Setup
        • Adding Permissions.
        • Adding License
      • Functions
        • Fetching License Details
        • Setting Configurations, Error messages, Camera customization
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • Xamarin
      • Project Setup
      • Android Setup
        • Adding Permission & Packages
        • Adding License
      • iOS Setup
        • Adding Permissions
        • Adding License
      • Functions
        • Fetching License details
        • Setup custom messages
        • OCR
        • MRZ
        • Barcode & Bankcard
        • Facematch & Liveness
    • Docker
      • MRZ
      • FaceMatch
      • Face Liveness
      • ID Liveness
      • ID Forgery
    • Web API
      • Accura OCR
      • Accura Face Match
      • Accura Face Liveness
      • Accura ID Liveness
  • Solutions
    • MRZ
      • Android
        • SDK Setup
        • Setup Accura MRZ
      • iOS
        • SDK Setup
        • Setup Accura MRZ
      • Flutter
        • SDK Setup
        • Setup Accura MRZ
      • React Native
        • SDK Setup
        • Setup Accura MRZ
      • Cordova
        • SDK Setup
        • Setup Accura MRZ
    • OCR
      • Android
        • SDK Setup
        • Setup Accura OCR
      • iOS
        • SDK Setup
        • Setup Accura OCR
      • Flutter
        • SDK Setup
        • Setup Accura OCR
      • React Native
        • SDK Setup
        • Setup Accura OCR
      • Cordova
        • SDK Setup
        • Setup Accura OCR
    • Barcode with PDF417
      • Android
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • iOS
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • Flutter
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • React Native
        • SDK Setup
        • Setup Accura Barcode with PDF417
      • Cordova
        • SDK Setup
        • Setup Accura Barcode with PDF417
    • Face Match
      • Android
        • Setup SDK
        • Setup Accura Face Match
      • iOS
        • Setup SDK
        • Setup Accura Face Match
      • Flutter
        • Setup SDK
        • Setup Accura Face Match
      • React Native
        • Setup SDK
        • Setup Accura Face Match
      • Cordova
        • Setup SDK
        • Setup Accura Face Match
    • Face Liveness (2D / Silent / Passive)
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Setup Accura Face Liveness
    • Face Liveness (3D / Face Movement)
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Setup Accura Face Liveness
    • Face Liveness with Voice Authentication
      • Android
        • SDK Setup
        • Setup Accura Face Liveness
      • iOS
        • SDK Setup
        • Setup Accura Face Liveness
      • Flutter
        • Setup SDK
        • Setup Accura Face Liveness
      • React Native
        • SDK Setup
        • Setup Accura Face Liveness
      • Cordova
        • Setup SDK
        • Set up Accura Face Liveness
    • ⁠Document Liveness and ID Forgery
      • Android
        • SDK Setup
        • Setup Accura OCR
      • iOS
        • SDK Setup
        • Setup Accura OCR
      • Flutter
        • SDK Setup
        • Setup Accura OCR
      • React Native
        • SDK Setup
        • Setup Accura OCR
      • Cordova
        • SDK Setup
        • Setup Accura OCR
    • NFC scanner
      • Android
        • SDK Setup
        • Setup Accura NFC
      • iOS
        • SDK Setup
        • Setup Accura NFC
      • Flutter
        • SDK Setup
        • Setup Accura NFC
      • React Native
        • SDK Setup
        • Setup Accura NFC
      • Cordova
        • SDK Setup
        • Setup Accura NFC
    • Voice Biometrics
      • Android
        • Setup Voice Verification
      • iOS
        • Setup Voice Verification
      • Flutter
        • Setup Voice Verification
      • React Native
        • Setup Voice Verification
      • Cordova
        • Setup Voice Verification
    • Finger Biometrics
      • Android
        • SDK Setup
        • Setup Accura Finger
      • iOS
        • SDK Setup
        • Setup Accura Finger
      • Flutter
        • SDK Setup
        • Setup Accura Finger
      • React Native
        • SDK Setup
        • Setup Accura Finger
      • Cordova
        • SDK Setup
        • Setup Accura Finger
    • MICR Cheque scanner
      • Android
        • SDK Setup
        • Setup Accura MICR
      • iOS
        • SDK Setup
        • Setup Accura MICR
      • Flutter
        • SDK Setup
        • Setup Accura MICR
      • React Native
        • SDK Setup
        • Setup Accura MICR
      • Cordova
        • SDK Setup
        • Setup Accura MICR
Powered by GitBook
On this page
  1. Solutions
  2. Voice Biometrics
  3. Flutter

Setup Voice Verification

Uploading Api details to matches enrolled user's audio files with target user's audio file

try {
      final directory = await getApplicationDocumentsDirectory();
      var uri = Uri.parse("Your API");
      var request = http.MultipartRequest("POST", uri);

      // Input Source One .wav formate
      var sourceOnePath = '${directory.path}/${widget.username}_0.wav';
      var sourceOneFile = File(sourceOnePath);
      if (!await sourceOneFile.exists()) {
        throw Exception('Source one recording not found');
      }
      // var sourceOneWav = await _convertToWav(sourceOnePath, 0);
      request.files.add(await http.MultipartFile.fromPath(
        'sourceone',
        sourceOneFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'sourceone.wav',
      ));

      // Input Source Two .wav formate
      var sourceTwoPath = '${directory.path}/${widget.username}_1.wav';
      var sourceTwoFile = File(sourceTwoPath);
      if (!await sourceTwoFile.exists()) {
        throw Exception('Source two recording not found');
      }
      // var sourceTwoWav = await _convertToWav(sourceTwoPath, 1);
      request.files.add(await http.MultipartFile.fromPath(
        'sourcetwo',
        sourceTwoFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'sourcetwo.wav',
      ));

      // Input Source Three .wav formate
      var sourceThreePath = '${directory.path}/${widget.username}_2.wav';
      var sourceThreeFile = File(sourceThreePath);
      if (!await sourceThreeFile.exists()) {
        throw Exception('Source three recording not found');
      }
      // var sourceThreeWav = await _convertToWav(sourceThreePath, 2);
      request.files.add(await http.MultipartFile.fromPath(
        'sourcethree',
        sourceThreeFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'sourcethree.wav',
      ));

      // Input Source Four .wav formate
      File verifyFile;
      if (audioFiles.isNotEmpty) {
        verifyFile = audioFiles[0];
      } else {
        final verifyPath = '${directory.path}/${widget.username}_3.wav';
        verifyFile = File(verifyPath);
        if (!await verifyFile.exists()) {
          throw Exception('Verification recording not found');
        }
      }
      // var verifyWav = await _convertToWav(verifyFile.path, 3);
      request.files.add(await http.MultipartFile.fromPath(
        'target',
        verifyFile.path,
        contentType: MediaType("audio", "wav"),
        filename: 'target.wav',
      ));

      // Send request
      var response = await request.send();
      if (response.statusCode == 200) {
        var responseBody = await response.stream.bytesToString();
        final Map<String, dynamic> parsedResponse = jsonDecode(responseBody);
        final String score = parsedResponse['score'];
        print('Matching Score: $score');
        ScaffoldMessenger.of(context).showSnackBar(
          SnackBar(content: Text('Matching Score: $score')),
        );
      } else {
        throw Exception('Upload failed with status ${response.statusCode}');
      }
    } catch (e) {
      ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(content: Text('Error during upload: $e')),
      );
    }
PreviousFlutterNextReact Native

Last updated 1 month ago