diff --git a/client/js/chat-client.js b/client/js/chat-client.js index 95f806e..59ff8eb 100644 --- a/client/js/chat-client.js +++ b/client/js/chat-client.js @@ -63,6 +63,10 @@ export class ChatApp extends DtpApp { this.emojiPicker.addEventListener('emoji-click', this.onEmojiPicked.bind(this)); } + this.pendingFiles = { + images: [ ], + videos: [ ], + }; this.dragFeedback = document.querySelector('.dtp-drop-feedback'); window.addEventListener('dtp-load', this.onDtpLoad.bind(this)); @@ -274,7 +278,7 @@ export class ChatApp extends DtpApp { // set focus back to chat input this.chat.imageFiles.value = null; - this.chat.videoFile = null; + this.chat.videoFile.value = null; this.chat.input.focus(); this.chat.sendButton.setAttribute('disabled', ''); @@ -365,7 +369,9 @@ export class ChatApp extends DtpApp { async onChatMessage (message) { const isAtBottom = this.chat.isAtBottom; this.chat.messageList.insertAdjacentHTML('beforeend', message.html); - this.audio.playSound(ChatApp.SFX_CHAT_MESSAGE); + if (!this.haveFocus) { + this.audio.playSound(ChatApp.SFX_CHAT_MESSAGE); + } this.scrollChatToBottom(isAtBottom); if (!this.haveFocus && (this.notificationPermission === 'granted')) {