# Live transcription You can receive speech as [ZMVideoSDKLiveTranscriptionMessageInfo](https://marketplacefront.zoom.us/sdk/custom/macos/interface_z_m_video_s_d_k_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 `ZMVideoSDK.sharedVideoSDK()?.getLiveTranscriptionHelper()` to get the live transcription helper. ```swift let liveTranscriptionHelper = ZMVideoSDK.sharesharedVideoSDKInstance()?.getLiveTranscriptionHelper() ``` ```objectivec ZMVideoSDKLiveTranscriptionHelper *liveTranscriptionHelper = [[ZMVideoSDK sharedVideoSDK] 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 ```swift // Iterate and print out language ID and language name of supported spoken languages if let availableSpokenLanguages = liveTranscriptionHelper.getAvailableSpokenLanguages() { for language in availableSpokenLanguages { print("Spoken Language ID: \(language.languageID)") print("Spoken Language Name: \(language.languageName)") } } ``` ```objectivec // Iterate and print out the language ID and language name of supported spoken languages NSArray *availableSpokenLanguages = [liveTranscriptionHelper getAvailableSpokenLanguages]; if (availableSpokenLanguages != nil) { for (ZMVideoSDKLiveTranscriptionLanguage* language in availableSpokenLanguages) { NSLog(@"Spoken Language ID: %ld", (long)[language languageID]); NSLog(@"Spoken Language Name: %@", [language languageName]); } } ``` ### 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). ```swift liveTranscriptionHelper.setSpokenLanguage(0) ``` ```objectivec [liveTranscriptionHelper setSpokenLanguage: 0]; ``` ## Start transcription To start live transcription, call `startLiveTranscription()`. ```swift liveTranscriptionHelper.startLiveTranscription() ``` ```objectivec [liveTranscriptionHelper startLiveTranscription]; ``` ## Receive transcription To receive speech text, you must first inherit the `ZMVideoSDKDelegate` property in your calling class and assign the delegate to the same class. ```swift ZoomVideoSDK.shareInstance()?.addListener(self) extension MainViewController: ZMVideoSDKDelegate { } ``` ```objectivec @interface MainViewController () [[ZMVideoSDK sharedVideoSDK] addListener:self]; ``` The SDK invokes the following methods when it fires transcription-related events. ```swift extension MainViewController: ZMVideoSDKDelegate { func onLiveTranscriptionMsgReceived(_ messageInfo: ZMVideoSDKLiveTranscriptionMessageInfo!) { } func onLiveTranscriptionStatus(_ status: ZMVideoSDKLiveTranscriptionStatus) { } func onLiveTranscriptionMsgError(_ spokenLanguage: ZMVideoSDKLiveTranscriptionLanguage!, transcriptLanguage transcriptLanguage: ZMVideoSDKLiveTranscriptionLanguage!) { } } ``` ```objectivec - (void)onLiveTranscriptionMsgInfoReceived:(ZMVideoSDKLiveTranscriptionMessageInfo *)messageInfo { } - (void)onLiveTranscriptionStatus:(ZMVideoSDKLiveTranscriptionStatus)status { } - (void)onLiveTranscriptionMsgError:(ZMVideoSDKLiveTranscriptionLanguage *)spokenLanguage transcriptLanguage:(ZMVideoSDKLiveTranscriptionLanguage *)transcriptLanguage { } ``` To receive live transcription text, handle the events fired within `onLiveTranscriptionMsgReceived`. In the following code sample, `messageType` retrieves an enum to indicate the type of message that `messageContent` returns. ```swift func onLiveTranscriptionMsgReceived(_ messageInfo: ZMVideoSDKLiveTranscriptionMessageInfo!) { print("MessageInfoContent is :\(messageInfo.messageContent)") print("MessageInfoType is :\(messageInfo.messageType)") } ``` ```objectivec - (void)onLiveTranscriptionMsgReceived:(ZMVideoSDKLiveTranscriptionMessageInfo *)messageInfo { NSLog(@"MessageInfoContent is : %@", [messageInfo messageContent]); NSLog(@"MessageInfoType is : %u", [messageInfo messageType]); } ``` `messageType` returns the transcription operation type, such as whether the message was added or the operation was completed. For more information, see [Transcription operation type enums](/docs/video-sdk/macos/translation/#transcription-operation-type-enums). ## Stop transcription To stop live transcription, call `stopLiveTranscription()`. ```swift liveTranscriptionHelper.stopLiveTranscription() ``` ```objectivec [liveTranscriptionHelper 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 [ZMVideoSDKLiveTranscriptionHelper](https://marketplacefront.zoom.us/sdk/custom/macos/interface_z_m_video_s_d_k_live_transcription_helper.html) in the _Zoom SDK for macOS_.