big-school-62939
03/05/2026, 5:44 PMtall-airline-16756
03/05/2026, 5:45 PMtall-airline-16756
03/05/2026, 5:45 PMRoom.RegisterTextStreamHandler("lk.transcription", ...)) for transcriptions; the issue is how the transcription stream messages are being read and filtered.
What to check and change
• Only act on streams that are transcriptions of audio: the stream will include the attribute lk.transcribed_track_id. If that attribute is missing, the message is a text message (not STT).
• Only process final transcripts: the attribute lk.transcription_final will be "true" for the final completed transcription. Interim updates can be empty or partial.
• Read the stream payload fully with ReadAll() (or your SDK equivalent) and assemble the returned messages into the full transcription before using it.
Suggested Unity (C#) pattern
1. Register the handler on lk.transcription.
2. In the callback:
◦ Check reader.Info.Attributes for lk.transcribed_track_id (confirm audio STT).
◦ Check lk.transcription_final == "true" (confirm final transcript).
◦ Call await reader.ReadAll() and combine the returned pieces into a single string.
◦ Only then process/display the transcription.
Short example outline:
room.RegisterTextStreamHandler("lk.transcription", async (reader, participantIdentity) =>
{
var attrs = reader.Info.Attributes;
var isTranscription = attrs.ContainsKey("lk.transcribed_track_id");
var isFinal = attrs.TryGetValue("lk.transcription_final", out var v) && v == "true";
if (!isTranscription) return; // not audio STT
if (!isFinal) return; // skip interim or handle separately
var pieces = await reader.ReadAll();
var full = string.Concat(pieces);
if (!string.IsNullOrEmpty(full))
{
Debug.Log($"Final transcription from {participantIdentity}: {full}");
// handle transcription...
}
});
Why you were getting empty transcriptions
• If you read interim streams (or read before the final segment arrives) you may receive empty/partial results.
• If you didn’t check for lk.transcribed_track_id, you might be treating non-audio text messages as STT and getting empty content.
If you want, tell me:
• Whether you currently check lk.transcription_final and lk.transcribed_track_id in your handler.
• If you still see empty final transcripts after implementing the checks above (and I’ll suggest next diagnostics). Sources: Text and transcriptions | LiveKit Documentationbig-school-62939
03/05/2026, 5:56 PMtall-airline-16756
03/05/2026, 5:56 PMRegisterTextStreamHandler) — specifically how you:
• Inspect reader.Info.Attributes
• Call ReadAll() (or equivalent) and assemble the pieces
• Log or return the final string
2) Are you seeing any values for these attributes on user speech messages? Please paste an example of reader.Info.Attributes for a user transcription message (masked any PII). I’m especially looking for lk.transcribed_track_id, lk.transcription_final, and lk.segment_id.
3) Are users sending audio from a local microphone track in the same client, or are they remote participants? In other words, is the transcribed track coming from a published audio track in the Room?
4) How are you publishing the user’s microphone audio? Briefly:
• Which Unity SDK version are you using?
• Which method do you use to publish audio (e.g., LocalAudioTrack.CreateFromDevice() or custom capture)?
• Any custom audio processing (resampling, muting, track replacement) before publishing?
5) Any logs or console errors when the user speaks (SDK warnings about audio, track state, or transcription)? If possible, paste the relevant log lines.
6) Are agent transcriptions always non-empty while user transcriptions are empty? If yes, confirm whether the agent’s audio is published differently (e.g., generated TTS or a text stream) compared to the user microphone track.
What I’ll do with this info
• If the attributes are present but payloads are empty, I’ll suggest targeted checks (track publication state, STT configuration, segment timing).
• If lk.transcribed_track_id is missing for user messages, I’ll explain why those messages are not STT and how to ensure the audio track is eligible for transcription.
• If you provide code I’ll point out any likely issues (e.g., reading the stream too early, joining pieces incorrectly, or accidentally discarding data).
If you prefer, paste only the handler code and one example attribute set + one console log sample and I’ll start from there.