AITranscriberStore provides a complete set of AI real-time transcription management APIs, including starting, updating, and stopping real-time transcription. Through this class, you can implement real-time speech-to-text transcription with multi-language translation support during audio/video calls or live streaming.AITranscriberStore instance for a specific room. Configure the source language and translation languages before starting transcription.Property | Type | Description |
selfLanguage | Current user's self language. | |
realtimeMessageList | List of real-time transcription messages, updated automatically as transcription progresses. | |
isTranscriptionRunning | StateFlow<Boolean> | Whether transcription is currently running. |
transcriptionConfig | Current transcription configuration. | |
isInterpretationRunning | StateFlow<Boolean> | Whether interpretation is currently running. |
interpretationConfig | Current interpretation configuration. | |
interpretationVolume | StateFlow<Int> | Current interpretation volume level. |
Function | Description |
Create an instance for a specific room. | |
Start transcription. | |
Update transcription configuration. | |
Stop transcription. | |
Start interpretation. | |
Update interpretation configuration. | |
Stop interpretation. | |
Set interpretation volume. |
abstract fun startTranscription(myLanguage: SourceLanguage, config: TranscriptionConfig = TranscriptionConfig(), completion: CompletionHandler? = null)
Parameter | Type | Description |
myLanguage | The source language for the current user's speech recognition. | |
config | Transcription configuration, including whether to enable translation. | |
completion | CompletionHandler? | Completion callback (success/failure status). |
abstract fun updateTranscription(myLanguage: SourceLanguage, config: TranscriptionConfig = TranscriptionConfig(), completion: CompletionHandler? = null)
Parameter | Type | Description |
myLanguage | The new source language for speech recognition. | |
config | New transcription configuration. | |
completion | CompletionHandler? | Completion callback (success/failure status). |
abstract fun stopTranscription(completion: CompletionHandler? = null)
Parameter | Type | Description |
completion | CompletionHandler? | Completion callback (success/failure status). |
abstract fun startInterpretation(myLanguage: SourceLanguage, config: InterpretationConfig = InterpretationConfig(), completion: CompletionHandler? = null)
Parameter | Type | Description |
myLanguage | The source language for interpretation. | |
config | Interpretation configuration, including voice type. | |
completion | CompletionHandler? | Completion callback (success/failure status). |
abstract fun updateInterpretation(myLanguage: SourceLanguage, config: InterpretationConfig = InterpretationConfig(), completion: CompletionHandler? = null)
Parameter | Type | Description |
myLanguage | The new source language for interpretation. | |
config | New interpretation configuration. | |
completion | CompletionHandler? | Completion callback (success/failure status). |
abstract fun stopInterpretation(completion: CompletionHandler? = null)
Parameter | Type | Description |
completion | CompletionHandler? | Completion callback (success/failure status). |
abstract fun setInterpretationVolume(volume: Int, completion: CompletionHandler? = null)
Parameter | Type | Description |
volume | Int | Volume level. |
completion | CompletionHandler? | Completion callback (success/failure status). |
Method | Description |
onReceiveTranscriberMessage | Triggered when a new transcription message is received. |
onRealtimeTranscriberStarted | Triggered when the real-time transcription service has been started successfully. |
onRealtimeTranscriberStopped | Triggered when the real-time transcription service has been stopped. |
onRealtimeTranscriberError | Triggered when an error occurs during real-time transcription. |
Enum Value | Value | Description |
CHINESE_ENGLISH | zh_en | Chinese-English mixed recognition. |
CHINESE | zh | Chinese. |
ENGLISH | en | English. |
CANTONESE | zh-yue | Cantonese. |
VIETNAMESE | vi | Vietnamese. |
JAPANESE | ja | Japanese. |
KOREAN | ko | Korean. |
INDONESIAN | id | Indonesian. |
THAI | th | Thai. |
PORTUGUESE | pt | Portuguese. |
TURKISH | tr | Turkish. |
ARABIC | ar | Arabic. |
SPANISH | es | Spanish. |
HINDI | hi | Hindi. |
FRENCH | fr | French. |
MALAY | ms | Malay. |
FILIPINO | fil | Filipino. |
GERMAN | de | German. |
ITALIAN | it | Italian. |
RUSSIAN | ru | Russian. |
Enum Value | Value | Description |
CHINESE | zh | Chinese. |
ENGLISH | en | English. |
VIETNAMESE | vi | Vietnamese. |
JAPANESE | ja | Japanese. |
KOREAN | ko | Korean. |
INDONESIAN | id | Indonesian. |
THAI | th | Thai. |
PORTUGUESE | pt | Portuguese. |
ARABIC | ar | Arabic. |
SPANISH | es | Spanish. |
FRENCH | fr | French. |
MALAY | ms | Malay. |
GERMAN | de | German. |
ITALIAN | it | Italian. |
RUSSIAN | ru | Russian. |
Enum Value | Value | Description |
FEMALE | female | Female voice. |
MALE | male | Male voice. |
Property | Type | Description |
segmentId | String | Unique identifier of the transcription segment. |
speakerUserId | String | User ID of the speaker. |
speakerUserName | String | Display name of the speaker. |
sourceText | String | Original transcribed text from the speech recognition. |
translationTexts | Translation results, keyed by target language. Contains translation texts for each configured translation language. | |
timestamp | Long | Timestamp of the message. |
isCompleted | Boolean | Whether the segment transcription is completed. When true, the source text and translation texts will no longer be updated. |
Property | Type | Description |
enableTranslation | Boolean | Whether to enable translation during transcription. |
Property | Type | Description |
voice | Voice type for interpretation output. |
Property | Type | Description |
sourceLanguage | Source language for speech recognition, defaults to Chinese-English mixed. | |
translationLanguages | List of target languages for translation. Multiple languages can be configured simultaneously. |
Property | Type | Description |
selfLanguage | Current user's self language. | |
realtimeMessageList | List of real-time transcription messages, updated automatically as transcription progresses. | |
isTranscriptionRunning | StateFlow<Boolean> | Whether transcription is currently running. |
transcriptionConfig | Current transcription configuration. | |
isInterpretationRunning | StateFlow<Boolean> | Whether interpretation is currently running. |
interpretationConfig | Current interpretation configuration. | |
interpretationVolume | StateFlow<Int> | Current interpretation volume level. |
// Create instance for a specific roomval store = AITranscriberStore.create("your_room_id")// Subscribe to state changeslifecycleScope.launch {store.transcriberState.realtimeMessageList.collect { messages ->messages.forEach { message ->println("Speaker: ${message.speakerUserName}")println("Source text: ${message.sourceText}")}}}// Configure transcriptionval config = TranscriberConfig(sourceLanguage = SourceLanguage.CHINESE_ENGLISH,translationLanguages = mutableListOf(TranslationLanguage.ENGLISH, TranslationLanguage.JAPANESE))// Start transcriptionstore.startRealtimeTranscriber(config) { code, message ->if (code != 0) {println("Start failed: $message")}}
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan