Live Transcription for Conferencing (Closed Captions - Beta)

100ms real-time transcription engine generates a live transcript (closed captions) during a conferencing session. The SDK provides a callback with the transcript for each peer when they speak.

Minimum Requirements

  • 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:

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:

public func on(transcripts: HMSTranscripts) { transcripts.transcripts.forEach { transcript in // handle transcript } }

Here is an example implemenation:

public func on(transcripts: HMSTranscripts) { transcripts.transcripts.forEach { transcript in let peerModel = transcript.peer if !(lastTranscript?.isFinal ?? false) { _ = self.transcriptArray.popLast() } if peerModel == lastTranscript?.peer { self.transcriptArray += [" " + transcript.transcript] } else { // if last transcript was not final pop the speaker label as well if !(lastTranscript?.isFinal ?? false) { if transcriptArray.last?.contains(":") ?? false { _ = self.transcriptArray.popLast() } } self.transcriptArray += ["\n**\(peerModel.name.trimmingCharacters(in: .whitespacesAndNewlines)):** "] self.transcriptArray += ["\(transcript.transcript)"] } 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:

// 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 } }

Have a suggestion? Recommend changes ->

Was this helpful?

1234