nice-room-70150
11/22/2025, 6:42 AMtall-airline-16756
11/22/2025, 6:42 AMtall-airline-16756
11/22/2025, 6:42 AMlk.transcription topic:
room.registerTextStreamHandler('lk.transcription', async (reader, participantIdentity) => {
const message = await reader.readAll();
const attrs = reader.info.attributes || {};
const isFinal = attrs['lk.transcription_final'] === 'true';
const transcribedTrackId = attrs['lk.transcribed_track_id'];
const segmentId = attrs['lk.segment_id'];
if (transcribedTrackId) {
console.log(`Transcription from ${participantIdentity} [final=${isFinal}, segment=${segmentId}]:`, message);
} else {
console.log(`Text message from ${participantIdentity}:`, message);
}
});
1. Key attributes to check:
• lk.transcribed_track_id — identifies that the message is a transcription and which track it came from.
• lk.transcription_final — "true" for final segments, absent/false for interim updates.
• lk.segment_id — identifies the transcription segment.
1. Notes:
• LiveKit Agents publish transcriptions to lk.transcription.
• Interim vs final updates may be sent; use lk.transcription_final to distinguish.
Would you like a variant that stores transcriptions per participant or emits real-time UI updates for interim text?
Sources: Text and transcriptions | LiveKit docsnice-room-70150
11/22/2025, 6:45 AMtall-airline-16756
11/22/2025, 6:45 AMlk.transcription topic:
room.registerTextStreamHandler('lk.transcription', async (reader, participant) => {
try {
const message = await reader.readAll();
const attrs = reader.info.attributes || {};
const isFinal = attrs['lk.transcription_final'] === 'true';
const transcribedTrackId = attrs['lk.transcribed_track_id'];
const segmentId = attrs['lk.segment_id'];
if (transcribedTrackId) {
console.log(`Transcription from ${participant.identity} [final=${isFinal}, segment=${segmentId}]:`, message);
} else {
console.log(`Text message from ${participant.identity}:`, message);
}
} catch (err) {
console.error('Error reading text stream:', err);
}
});
1. Important attributes to check:
• lk.transcribed_track_id — indicates this message is a transcription and which audio track it came from.
• lk.transcription_final — "true" for final segments; absent/false for interim updates.
• lk.segment_id — groups interim and final messages for the same spoken segment.
1. UX tips:
• Show interim text while lk.transcription_final is not true, then replace with the final text when final arrives to avoid duplicates.
• For React apps, consider useTranscriptions from @livekit/components-react to simplify integration.
Would you like an example that accumulates transcriptions per participant or a React-specific snippet?
Sources: Text and transcriptions | LiveKit docs