# Live transcription

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

You can receive speech as [ILiveTranscriptionMessageInfo](https://marketplacefront.zoom.us/sdk/custom/android/interfaceus_1_1zoom_1_1sdk_1_1_zoom_video_s_d_k_live_transcription_helper_1_1_i_live_transcription_message_info.html) objects, in real time, using the Zoom [live transcription and translation feature](https://support.zoom.us/hc/en-us/articles/6643133682957-Enabling-and-configuring-translated-captions) (LTT).

> Zoom recommends that you provide an in-product notice to your end-users when a participant enables live transcription.

## Initialize LTT

After joining a session, call `ZoomVideoSDK.getInstance().getLiveTranscriptionHelper()` to get the live transcription helper.

```kotlin
val lttHelper = ZoomVideoSDK.getInstance().liveTranscriptionHelper
```

```java
ZoomVideoSDKLiveTranscriptionHelper lttHelper = ZoomVideoSDK.getInstance().getLiveTranscriptionHelper();
```

## Supported languages

We are continuously adding to our supported languages for transcription. The following code samples demonstrate how you can check on the list of supported spoken languages.

### List supported spoken languages

```kotlin
// iterate and print out language ID and language name of supported spoken languages

lttHelper.availableSpokenLanguages.forEach {
  Log.d(TAG, "Spoken language ID: ${it.lttLanguageID}")
  Log.d(TAG, "Spoken language name: ${it.lttLanguageName}")
}
```

```java
// iterate and print out language ID and language name of supported spoken languages

List<ZoomVideoSDKLiveTranscriptionHelper.ILiveTranscriptionLanguage> availableSpokenLanguages = lttHelper.getAvailableSpokenLanguages();

if (availableSpokenLanguages != null) {
    for (int i = 0; i < availableSpokenLanguages.size(); ++i) {
        ZoomVideoSDKLiveTranscriptionHelper.ILiveTranscriptionLanguage language = availableSpokenLanguages.get(i);

        if (language != null) {
            Log.d(TAG, "Spoken language ID: "+ language.getLTTLanguageID());
            Log.d(TAG, "Spoken language name: " + language.getLTTLanguageName());
        }
    }
}
```

### Set spoken language

Typically, you might set the spoken language using `setSpokenLanguage(language_id)` before starting live transcription. If you do not set it, the spoken language defaults to “English” (0).

```kotlin
lttHelper.setSpokenLanguage(0)
```

```java
lttHelper.setSpokenLanguage(0);
```

## Start transcription

To start live transcription, call `startLiveTranscription()`.

```kotlin
if (lttHelper.canStartLiveTranscription()) {
    lttHelper.startLiveTranscription()
}
```

```java
if (lttHelper.canStartLiveTranscription()) {
    lttHelper.startLiveTranscription();
}
```

## Receive transcription

To receive speech text, you must first inherit the `ZoomVideoSDKDelegate` interface in your calling class and explicitly enable the reception of spoken language content.

```kotlin
class MainActivity : AppCompatActivity, ZoomVideoSDKDelegate
// Enable the reception of transcription/translation content
lttHelper.enableReceiveSpokenLanguageContent(true)
```

```java
public class MainActivity extends AppCompatActivity implements ZoomVideoSDKDelegate
// Enable the reception of transcription/translation content
lttHelper.enableReceiveSpokenLanguageContent(true);
```

Add this (`MainActivity`) to your `ZoomVideoSDK` event listener.

```kotlin
ZoomVideoSDK.getInstance().addListener(this)
```

```java
ZoomVideoSDK.getInstance().addListener(this);
```

The Video SDK for Android invokes the following methods when it fires transcription-related events.

```kotlin
override fun onLiveTranscriptionStatus(status: ZoomVideoSDKLiveTranscriptionHelper.ZoomVideoSDKLiveTranscriptionStatus) { }

override fun onLiveTranscriptionMsgInfoReceived(messageInfo: ZoomVideoSDKLiveTranscriptionHelper.ILiveTranscriptionMessageInfo) { }
```

```java
@Override

public void onLiveTranscriptionStatus(ZoomVideoSDKLiveTranscriptionHelper.ZoomVideoSDKLiveTranscriptionStatus status) { }

@Override

public void onLiveTranscriptionMsgInfoReceived(ZoomVideoSDKLiveTranscriptionHelper.ILiveTranscriptionMessageInfo messageInfo) { }
```

To receive live transcription text, handle the events fired within `onLiveTranscriptionMsgInfoReceived`. In the following code sample, `getMessageType()` retrieves an enum to indicate the type of message that `getMessageContent()` returns.

```kotlin
override fun onLiveTranscriptionMsgInfoReceived(messageInfo: ZoomVideoSDKLiveTranscriptionHelper.ILiveTranscriptionMessageInfo) {
  Log,d(TAG, "Message info content is: ${messageInfo.messageContent}")
  Log.d(TAG, "Message info type is: ${messageInfo.messageType}")
}
```

```java
@Override

public void onLiveTranscriptionMsgInfoReceived(ZoomVideoSDKLiveTranscriptionHelper.ILiveTranscriptionMessageInfo messageInfo) {
    Log.d(TAG, "Message info content is: " + messageInfo.getMessageContent());
    Log.d(TAG, "Message info type is: " + messageInfo.getMessageType());
}
```

`getMessageType()` returns the transcription operation type, such as whether the message was added or the operation was completed. For more information, see the [Enum Reference](https://marketplacefront.zoom.us/sdk/custom/android/enumus_1_1zoom_1_1sdk_1_1_zoom_video_s_d_k_live_transcription_helper_1_1_zoom_video_s_d_k_live_transcription_operation_type.html#details).

## Stop transcription

To stop live transcription, call `stopLiveTranscription()`.

```kotlin
lttHelper.stopLiveTranscription()
```

```java
lttHelper.stopLiveTranscription();
```

## LTT best practices

When implementing Live Transcription and Translation (LTT) for your integration, consider the following best practices:

-   If the feature is enabled for the session, provide a button to allow people to start closed captioning and select the spoken and translated languages.
-   Display only the supported languages you wish to offer, rather than presenting all available options for transcription and translation.
-   If the session won't include LTT, programmatically disable when the host starts the session. When someone joins the session, check if the feature is enabled by the host. If not, inform users.
-   Use an event listener to detect when the host has enabled captions. You can use this to notify people that the feature is active, programmatically render a button for starting transcription or translation, or both.
-   Set `enableReceiveSpokenLanguageContent()` to false if you don't want to receive the spoken language data.
-   Use an event listener to detect when the host disables captions. You can use this to notify people who have enabled the feature that it has been disabled.
-   Offer closed captioning customization options, such as font sizes and colors, to differentiate between transcription and translation texts, to enhance readability and follow accessibility standards.
-   Inform people of these best practices when speaking:
    -   Minimize background noise, avoiding activities like shuffling papers, typing loudly, or engaging in side conversations.
    -   Speak clearly into the microphone.
    -   Position the microphone near active speakers.
    -   Opt for an external microphone over a built-in one to improve sound quality.
