Introduction
The TTS module is an Fcloud service developed by Ftech. The module allows customer converse speech to text through the application of electronic technology. To integrate and use this service, you must use Fcloud's SDK. And here are instructions for integrating the SDK.
Authentication
To call the APIs, we will have to init the SDK with the parameters ClientID and SecretKey taken when you create the Application on CMS for partners according to the following instructions:
- Log in to CMS Partner with the username/password provided (https://fcloud-partner-cms.ftech.ai)
- Buy a service package
- Create App
Server Integrator
After integrating the SDK, the Fcloud service supports server-server callbacks to help get request information as quickly and accurately as possible.
Web SDK
Android SDK
Install SDK Android
Setup gradle maven
- With Gradle v1.x - v5.x
Open
build.grade
file and addmaven
line like below
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } <- add this line
}
}
- With Gradle v6.x+
Open
setting.gradle
file and addmaven
line like below
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } <- add this line
}
}
Open file app/build.grade
then add sdk
dependencies {
...
implementation "com.github.FTechMobile:fstt-android:1.0.7"
}
Init in file Application
- Java
@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onCreate(savedInstanceState, persistentState);
...
STTManager.init(getApplicationContext());
}
- Kotlin
override fun onCreate() {
super.onCreate()
...
STTManager.init(this)
}
SDK Android Feature
Init
Param | Type | Description |
---|---|---|
appId | String | Application id |
secretKey | String | IOE secret key |
- Java
STTManager.initGateway("your_app_id", "your_secret_key", new IInitGatewayCallback() {
@Override
public void onSuccess() {
}
@Override
public void onFail(@Nullable AppException error) {
}
});
- Kotlin
STTManager.initGateway(appId, secretKey, object : IInitGatewayCallback {
override fun onSuccess() {
}
override fun onFail(error: AppException?) {
}
})
Register callback
After registration, the SDK will return the corresponding status in the callback
Status | Description |
---|---|
onStart | Called at start record |
onRecording | Called while in process recording |
onSuccess | Called when completed record process and return result |
onFail | Called when an error occurs in process recording |
- Java
STTManager.registerSTTCallback(new ISTTCallback() {
@Override
public void onStart() {
}
@Override
public void onRecording() {
}
@Override
public void onFail(@Nullable AppException error) {
}
@Override
public void onSuccess(@NonNull String result) {
}
});
- Kotlin
STTManager.registerSTTCallback(object : ISTTCallback {
override fun onStart() {
}
override fun onRecording() {
}
override fun onFail(error: AppException?) {
}
override fun onSuccess(result: String) {
})
})
Start
- Used to start record for STT
- When successful start, the SDK starts entering the recording state, it will be called on
onStart()
in callback. Handling start record successfully here. - When start record fails, it will be processed at callback
onFail()
in callback.
STTManager.startSTT();
Stop
- Used to stop record and process record to text result
- When successful, the SDK will be return text result on
onSuccess()
in callback. Handling stop record successfully here. - When fails, it will be processed at callback
onFail()
in callback.
STTManager.stopSTT();
IOS SDK
Install SDK IOS
Add package dependencies
https://github.com/FTechMobile/fekyc
SDK IOS Integration
Register callback
FTechSSTManager.instance().delegate = self
Init
Param | Type | Description |
---|---|---|
appId | String | Application id |
key | String | Secret key |
FTechSSTManager.instance().initSDK(appId: "", key: "")
Implement FTechSSTManagerDelegate
- After registration, the SDK will return the corresponding status in the callback
status | Description |
---|---|
onStart | Called at start record |
onRecording | Called while in process recording |
onCompletion | Called when completed record process and return result |
onFailure | Called when an error occurs in process recording |
extension ViewController: FTechSSTManagerDelegate {
func onStart() {
}
func onRecording() {
}
func onCompletion(data: STTResponse) {
}
func onFailure(error: FTError) {
}
}
SDK IOS Feature
Start
- Used to start record for STT
- When successful start, the SDK starts entering the recording state, it will be called on onStart() in callback. Handling start record successfully here.
- When start record fails, it will be processed at callback onFailure() in callback
FTechSSTManager.instance().startRecording()
Stop
- Used to stop record and process record to text result
- When successful, the SDK will be return text result on
onCompletion()
in callback. Handling stop record successfully here. - When fails, it will be processed at callback
onFailure()
in callback.
FTechSSTManager.instance().stopRecoding()
Errors
The Kittn API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The kitten requested is hidden for administrators only. |
404 | Not Found -- The specified kitten could not be found. |
405 | Method Not Allowed -- You tried to access a kitten with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |