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