From c5e54b62ac207268675481a1f30962d6ebe84f03 Mon Sep 17 00:00:00 2001 From: Elijah R Date: Wed, 10 Jul 2024 23:20:03 -0400 Subject: [PATCH] minor bugfixes --- webapp/src/ts/client.ts | 6 ++++-- webapp/src/ts/main.ts | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/webapp/src/ts/client.ts b/webapp/src/ts/client.ts index 8774389..e266a01 100644 --- a/webapp/src/ts/client.ts +++ b/webapp/src/ts/client.ts @@ -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); + this.playingAudio.delete(user!.username); + } }, 1000); }); diff --git a/webapp/src/ts/main.ts b/webapp/src/ts/main.ts index fbf80dc..7655918 100644 --- a/webapp/src/ts/main.ts +++ b/webapp/src/ts/main.ts @@ -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();