NAV
javascript

Introduction

The TTS module is an Fcloud service developed by Ftech. The module allows customer converse text to speech 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:ftts-android:1.0.2"
}

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()
        ...
        TTSManager.init(this)
    }

SDK Android Feature

Init

Param Type Description
appId String Application id
secretKey String IOE secret key

Register callback

After registration, the SDK will return the corresponding status in the callback

Status Description
onStart Called at start record
onPlaying Called while audio playing
onSuccess Called when return result
onFail Called when an error occurs in process

Get language config

Start

IOS SDK

Install SDK IOS

Supports devices with Apple Neural Engine in iOS 14 and iPadOS 14 and requires a device with a TrueDepth camera on iOS 13 and iPadOS 13 and earlier.

Add package dependencies

SDK IOS Integration

Init

Param Type Description
appId String Application id
key String Ekyc license key
FTechTTSManager.instance().initSDK(appId: String, key: String) {
    // onSuccess
} onFailure: { error in
    // onFailure
}

Register callback

FTechTTSManager.instance().delegate = self

SDK IOS Feature

Implement FTechTTSMangerDelegate

extension ViewController: FTechTTSMangerDelegate {
    func onSuccess(data: TTSResponse) {
    }

    func onFailure(error: FTError) {
    }
}

Get language config

FTechTTSManager.instance().getLanguageConfig {
    // onSuccess
    } onFailure: { 
    // onFailure
}

Start

FTechTTSManager.instance().startTTS(language: language,
                                    voice: voice,
                                    content: content, 
                                    isPlayAudio: true)

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.