Skip to main content

Transcriptions

Enabling your application to provide a transcript for a call can be beneficial for your users. We understand, though, that this can be a challenging feature to implement/support.

This is why, the Stream Video SDK comes with out of the box Transcription support that you can easily manage.

The Call object provides a few levels of control. The first one is in the call.state.settings.transcription where you can find settings related to transcription, as they have been configured from the dashboard. The mode property defines the feature's availability with:

  • available: the feature is available for your call and can be enabled.
  • disabled: the feature is not available for your call. In this case, it's a good idea to "hide" any UI element you have related to transcription.
  • auto-on: the feature is available, and it will be enabled automatically, once the user is connected on the call.

The second level of control is the call.state.transcribing which allows you to check if the transcription is enabled at any given time.

For both of these, we expose a utility observables that we recommend you to subscribe on:

import { Call } from '@stream-io/video-client';

let call: Call;

const unsubscribeSettings = call.state.settings$.subscribe((settings) => {
if (!settings) return;
const { transcription } = settings;
// ...
});

const unsubscribeIsTranscribing = call.state.transcribing$.subscribe(
(isTranscribing) => {
console.log('Is transcribing', isTranscribing);
},
);

// clean up
unsubscribeSettings();
unsubscribeIsTranscribing();

To enable call transcriptions you can use the following two methods:

import { Call, TranscriptionSettingsModeEnum } from '@stream-io/video-client';

let call: Call;

const isTranscribing = call.state.transcribing;
if (
call.state.settings?.transcriptions.mode !==
TranscriptionSettingsModeEnum.DISABLED &&
!isTranscribing
) {
await call.startTranscription();
} else {
await call.stopTranscription();
}

Did you find this page helpful?