Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc4f43e887 |
@ -63,20 +63,11 @@ room.registerTextStreamHandler("lk.transcription", async (reader, participantInf
|
|||||||
const trackId = reader.info.attributes["lk.transcribed_track_id"];
|
const trackId = reader.info.attributes["lk.transcribed_track_id"];
|
||||||
|
|
||||||
if (isFinal) {
|
if (isFinal) {
|
||||||
// Due to a bug in LiveKit Server the participantInfo object may be empty.
|
const speaker = participantInfo.identity == room.localParticipant.identity
|
||||||
// You can still get the participant owning the audio track like below:
|
? "You" : participantInfo.identity;
|
||||||
let participant;
|
|
||||||
if (localParticipant.audioTrackPublications.has(trackId)) {
|
|
||||||
participant = room.localParticipant;
|
|
||||||
} else {
|
|
||||||
participant = room.remoteParticipants.values().find(p => p.audioTrackPublications.has(trackId));
|
|
||||||
}
|
|
||||||
|
|
||||||
const captionsTextarea = document.getElementById("captions");
|
|
||||||
const timestamp = new Date().toLocaleTimeString();
|
const timestamp = new Date().toLocaleTimeString();
|
||||||
const participantIdentity =
|
const captionsTextarea = document.getElementById("captions");
|
||||||
participant == room.localParticipant ? "You" : participant.identity;
|
captionsTextarea.value += `[${timestamp}] ${speaker}: ${message}\n`;
|
||||||
captionsTextarea.value += `[${timestamp}] ${participantIdentity}: ${message}\n`;
|
|
||||||
captionsTextarea.scrollTop = captionsTextarea.scrollHeight;
|
captionsTextarea.scrollTop = captionsTextarea.scrollHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user