NAV
javascript

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:

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

allprojects {
    repositories {
        google()  
        mavenCentral()
        maven { url 'https://jitpack.io' } <- add this line
    }
}

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

@Override
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
    super.onCreate(savedInstanceState, persistentState);
    ...
    STTManager.init(getApplicationContext());
}
override fun onCreate() {
        super.onCreate()
        ...
        STTManager.init(this)
    }

SDK Android Feature

Init

Param Type Description
appId String Application id
secretKey String IOE secret key
STTManager.initGateway("your_app_id", "your_secret_key", new IInitGatewayCallback() {
    @Override
    public void onSuccess() {

    }

    @Override
    public void onFail(@Nullable AppException error) {

    }
});
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
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) {

    }
});
STTManager.registerSTTCallback(object : ISTTCallback {
    override fun onStart() {

    }

    override fun onRecording() {

    }

    override fun onFail(error: AppException?) {

    }

    override fun onSuccess(result: String) {

    })
})

Start

STTManager.startSTT();

Stop

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

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

FTechSSTManager.instance().startRecording()

Stop

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.