minor bugfixes

This commit is contained in:
Elijah R 2024-07-10 23:20:03 -04:00
parent 39fb90382c
commit c5e54b62ac
2 changed files with 7 additions and 5 deletions

View file

@ -168,6 +168,7 @@ export class MSAgentClient {
if (!user) return;
user.agent.hide(true);
if (this.playingAudio.has(user!.username)) {
this.playingAudio.get(user!.username)?.pause();
this.playingAudio.delete(user!.username);
}
this.users.splice(this.users.indexOf(user), 1);
@ -190,9 +191,10 @@ export class MSAgentClient {
audio.addEventListener('ended', () => {
// give a bit of time before the wordballoon disappears
setTimeout(() => {
if (this.playingAudio.get(user!.username) === audio)
if (this.playingAudio.get(user!.username) === audio) {
user!.agent.stopSpeaking();
this.playingAudio.delete(user!.username);
}
}, 1000);
});

View file

@ -29,9 +29,6 @@ logonWindow.show();
let loggingIn = false;
elements.logonForm.addEventListener('submit', e => {
if (loggingIn) return;
loggingIn = true;
elements.logonButton.disabled = true;
e.preventDefault();
connectToRoom();
});
@ -50,6 +47,9 @@ async function connectToRoom() {
alert("Please select an agent.");
return;
}
if (loggingIn) return;
loggingIn = true;
elements.logonButton.disabled = true;
await Room.connect();
await Room.join(elements.logonUsername.value, elements.agentSelect.value);
elements.chatInput.maxLength = Room.getCharlimit();