Live transcription
You can receive speech as ILiveTranscriptionMessageInfo objects, in real time, using the Zoom live transcription and translation feature (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 video_sdk_obj->getLiveTranscriptionHelper() to get the live transcription helper.
IZoomVideoSDKLiveTranscriptionHelper* m_ltthelper = video_sdk_obj->getSessionInfo()->getMyself()->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
//iterate and print out language ID and language Name of supported Spoken languages
IVideoSDKVector<ILiveTranscriptionLanguage*>* availableSpokenLanguages = m_ltthelper->getAvailableSpokenLanguages();
if (availableSpokenLanguages) {
for (size_t i = 0; i < availableSpokenLanguages->GetCount(); ++i) {
ILiveTranscriptionLanguage* language = availableSpokenLanguages->GetItem(i);
if (language) {
printf("Spoken Language ID: %d\n", language->getLTTLanguageID());
printf("Spoken Language Name: %s\n", language->getLTTLanguageName());
// Print other properties as needed
printf("---------------------\n");
}
}
}
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).
m_ltthelper->setSpokenLanguage(0);
Start transcription
To start live transcription, call startLiveTranscription().
ZoomVideoSDKErrors err = m_ltthelper->startLiveTranscription();
Receive transcription
To receive speech text, you will first need to inherit the IZoomVideoSDKDelegate interface from the calling class. For example: class CMainFrame :public IZoomVideoSDKDelegate.
Create an instance of ZoomVideoSDKDelegate and add it to your video_sdk_obj as a listener.
IZoomVideoSDKDelegate *listener = new ZoomVideoSDKDelegate();
video_sdk_obj->addListener(dynamic_cast<IZoomVideoSDKDelegate *>(listener));
After inheriting IZoomVideoSDKDelegate implement these virtual methods in CMainFrame.cpp. The SDK will invoke these when firing transcription-related events.
virtual void onLiveTranscriptionStatus(ZoomVideoSDKLiveTranscriptionStatus status);
virtual void onLiveTranscriptionMsgReceived(const zchar_t* ltMsg, IZoomVideoSDKUser* pUser, ZoomVideoSDKLiveTranscriptionOperationType type);
virtual void onLiveTranscriptionMsgError(ILiveTranscriptionLanguage* spokenLanguage, ILiveTranscriptionLanguage* transcriptLanguage);
virtual void onLiveTranscriptionMsgInfoReceived(ILiveTranscriptionMessageInfo* messageInfo) {};
To receive live transcription text, handle the events within onLiveTranscriptionMsgInfoReceived. In the following code sample, getMessageType() retrieves an enum to indicate the type of message that getMessageContent() returns.
virtual void onLiveTranscriptionMsgInfoReceived(ILiveTranscriptionMessageInfo* messageInfo) {
printf("MessageInfoContent is : %s\n",messageInfo->getMessageContent());
printf("MessageInfoType is : %d\n",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 Video SDK Reference.
Stop transcription
To stop live transcription, call stopLiveTranscription().
ZoomVideoSDKErrors err = m_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.
More LTT features
For the full set of live transcription features, see IZoomVideoSDKLiveTranscriptionHelper in the Zoom Video SDK for Linux.