diff --git a/docs/ios/v2/how-to-guides/set-up-video-conferencing/captions.mdx b/docs/ios/v2/how-to-guides/set-up-video-conferencing/captions.mdx index a9e19be88..6543dbdd6 100644 --- a/docs/ios/v2/how-to-guides/set-up-video-conferencing/captions.mdx +++ b/docs/ios/v2/how-to-guides/set-up-video-conferencing/captions.mdx @@ -8,17 +8,24 @@ The SDK provides a callback with the transcript for each peer when they speak. ## Minimum Requirements -- Minimum 100ms SDK version required is 1.9.0 +- Minimum 100ms SDK version required is 1.12.0 + +## How to check if captions are started in a room? + +To check if live captions are enabled in a room, check if transcriptionState of type caption is in started state in HMSRoom object like below: + +```swift +let captionsEnabled = hmsSDK.room?.transcriptionStates?.first { $0.state == HMSTranscriptionStatus.started } != nil } +``` ## How to implement closed captioning? Implement `on(transcripts: HMSTranscripts)` from `HMSUpdateListener` callback like below: ```swift - public func on(transcripts: HMSTranscripts) { - transcripts.transcripts.forEach { transcript in - // handle transcript - } +public func on(transcripts: HMSTranscripts) { + transcripts.transcripts.forEach { transcript in + // handle transcript } } ``` @@ -51,5 +58,27 @@ Here is an example implemenation: lastTranscript = transcript } } -} ``` + +## How to toggle Live Transcriptions on/off +You can toggle live transcriptions on/off at runtime that can help save costs. Use startTranscription() method to start the transcription and stopTranscription() method to stop transcription like below: +```swift + // Start Real Time Transcription + sdk.startTranscription() { success, error in + if let error = error { + // handle error + } else { + // success + } + } + + // Stop Real Time Transcription + sdk.stopTranscription() { success, error in + if let error = error { + // handle error + } else { + // success + } + } +``` +