Realtime Transcription - iOS
Realtime transcription allows you to transcribe audio content into text in real-time during a session. This guide will walk you through using the startTranscription()
and stopTranscription()
functions to manage realtime transcription in your application.
Moreover, VideoSDK offers flexibility in configuring real-time transcription, allowing you to set up webhooks for this purpose.
Please ensure eligibility prior to enabling post-transcription. For further details, please contact us.
Integrating Realtime Transcription Feature
The above image represents,
-
Start Transcription: The SDK Client initiates real-time transcription using the
startTranscription
method. -
Resource Acquisition: VideoSDK server requests necessary resources from transcription service.
- If the request is denied, the server sends a
TRANSCRIPTION-FAILED
event to the SDK Client. - If the request is successful, the server sends a
TRANSCRIPTION-STARTED
event to the client, indicating that transcription has begun.
- If the request is denied, the server sends a
-
Transcription Data: As transcription progresses, the client receives
onTranscriptionText
event with data such as the text itself, participant ID, and timestamp. -
Stop Transcription: When the client decides to stop transcription, it informs the VideoSDK server to release resources.
- The server then sends a
TRANSCRIPTION-STOPPED
event to confirm that transcription has ended and resources are released.
- The server then sends a
Step 1: Configure Realtime Transcription
- In this step, we set up the configuration for realtime transcription. We define the webhook URL where the webhooks will be received.
- Swift
// Realtime Transcription Configuration
let config = TranscriptionConfig(
webHookUrl: "YOUR_WEBHOOK_URL",
summary: SummaryConfig(
enabled: true,
prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary"
)
)
Step 2: Start realtime transcription
- Initiate the realtime transcription using the
startTranscription()
method.
- Swift
// Starts realtime transcription
@IBAction func startTranscriptionTapped(_ sender: Any) {
let config = TranscriptionConfig(
webHookUrl: "YOUR_WEBHOOK_URL",
summary: SummaryConfig(
enabled: true,
prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary"
)
)
meeting.startTranscription(config);
}
Step 3: Stop realtime transcription
- Terminate the realtime transcription using the
stopTranscription()
method.
- Swift
// Stops realtime transcription
@IBAction func stopTranscriptionTapped(_ sender: Any) {
meeting.stopTranscription();
}
Step 4: Listen for transcription events
- Here, we configure the callback methods for transcription events.
- Swift
import VideoSDKRTC
extension MeetingViewController: MeetingEventListener {
// Listen for transcription state changed event
func onTranscriptionStateChanged(state: TranscriptionState) {
switch state {
case .TRANSCRIPTION_STARTING:
print("transcription starting")
case .TRANSCRIPTION_STARTED:
print("transcription started")
case .TRANSCRIPTION_STOPPING:
print("transcription stopping")
case .TRANSCRIPTION_STOPPED:
print("transcription stopped")
}
}
// Listen for transcription text event
func onTranscriptionText(_ data: TranscriptionText) {
print("transcription text: ", data.text)
print("participant name", data.participantName)
}
}
API Reference
The API references for all the methods utilized in this guide are provided below.
Got a Question? Ask us on discord