Latest 1.0.2
Homepage https://github.com/aimmatic/natural-voice-mobile-sdk-ios
License MIT
Platforms ios 8.0
Dependencies Alamofire
Authors

Natural Voice Mobile SDK For iOS

This library allows you to integrate Natural Voice functions into your iOS app.

Requires API key. For a free API key you may contact our solution desk.

https://www.aimmatic.com/solution-desk.html

mailto:[email protected]

Please allow a few hours for a response.

Feature

Example:

Usage

Requirements

• iOS 8.0+

• xCode 9

Cocoapods

pod 'NaturalVoice'

Install

pod install

Info.plist

Natural Voice requires location service and microphone permission, you need to add these keys to Info.plist

<key>NSMicrophoneUsageDescription</key>
<string>YOUR_DESCRIPTION</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>YOUR_DESCRIPTION</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>YOUR_DESCRIPTION</string>

Add your ApiKey in Info.plist

<key>AimMaticNaturalVoiceApiKeyDescription</key>
<string>YOUR_API_KEY</string>

Using Voice Service

Get supported languages

VoiceLanguageManager.shared.getSupportLanguages { languages in }

Configuration

VoiceRecordStrategy.language = language
VoiceRecordStrategy.maxRecordDuration = 30
VoiceRecordStrategy.maxRecordDurationPolicy = .sendImmediately
VoiceRecordStrategy.speechTimeout = 2
VoiceRecordStrategy.speechTimeoutPolicy = .sendImmediately

Start recording

VoiceRecorder.shared.startRecording(recordStarted: { meta in

}, recordEnded: { response in

}, recordSent: { response in

}, recordFailed: { error in

})

Block handle

When recording is started

let recordStared: VoiceRecordStarted = { (meta: VoiceFileMeta?) in

}

When recording is finished

let recordEnded: VoiceRecordEnded = { (response: VoiceRecordEndResponse?) in

}

When recording is sent

let recordSent: VoiceRecordSent = { (response: VoiceRecordSendResponse?) in

}

When recording is failed

let recordFailed: VoiceRecordFailed = { (error: Error?) in

}

Handle policy .userChoice when recording is finished

if response?.policy == .userChoice {
    let controller = UIAlertController(title: "Send or Abort?", message: nil, preferredStyle: .alert)
    controller.addAction(UIAlertAction(title: "Send", style: .default, handler: { action in
        /* Send recorded file */
        response?.send()
    }))
    controller.addAction(UIAlertAction(title: "Abort", style: .cancel, handler: { action in
        /* Abort sending recorded file */
        response?.abort()
    }))
    self.present(controller, animated: true, completion: {})             
}

Stop recording

This will override policy that was set in

VoiceRecordStrategy.maxRecordDurationPolicy

Stop with decision

VoiceRecorder.shared.stopRecording(policy: .userChoice)

Stop and send immediately

VoiceRecorder.shared.stopRecording(policy: .sendImmediately)

Stop and cancel sending

VoiceRecorder.shared.stopRecording(policy: .cancel)

Latest podspec

{
    "name": "NaturalVoice",
    "version": "1.0.2",
    "summary": "Public beta client library to integrate voice feedback using Natural Voice.",
    "description": "Public beta client library to integrate voice feedback using Natural Voice (https://www.naturalvoice.ai) functions powered by Cloud Speech and Cloud Natural Language from Google Cloud Platformu2122 service",
    "homepage": "https://github.com/aimmatic/natural-voice-mobile-sdk-ios",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Aimmatic Dev Team": "[email protected]"
    },
    "source": {
        "git": "https://github.com/aimmatic/natural-voice-mobile-sdk-ios.git",
        "tag": "1.0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "NaturalVoice/Classes/**/*",
    "swift_version": "4.1",
    "dependencies": {
        "Alamofire": [
            "~> 4.7"
        ]
    }
}

Pin It on Pinterest

Share This