From fc573a8d8be026573b57eff783b1a8ef85008d31 Mon Sep 17 00:00:00 2001 From: TSO Date: Fri, 20 Oct 2023 12:46:19 +0000 Subject: [PATCH] [FIX] discuss: prevent push-to-talk release spam on some devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit, devices with the key-repeat feature turned on would not work well with the push-to-talk feature. This commit sets a minimum delay before a push-to-talk key is considered released. closes odoo/odoo#139396 X-original-commit: aced53322309898d060c082e3d009293123ffea0 Signed-off-by: Alexandre Kühn (aku) --- .../src/discuss/call/common/call_settings.xml | 2 +- .../static/src/discuss/call/common/rtc_service.js | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/mail/static/src/discuss/call/common/call_settings.xml b/addons/mail/static/src/discuss/call/common/call_settings.xml index bd4c2f5718e..a2ba4fb0b1a 100644 --- a/addons/mail/static/src/discuss/call/common/call_settings.xml +++ b/addons/mail/static/src/discuss/call/common/call_settings.xml @@ -41,7 +41,7 @@ diff --git a/addons/mail/static/src/discuss/call/common/rtc_service.js b/addons/mail/static/src/discuss/call/common/rtc_service.js index 509f0569410..d9c6ed7dc98 100644 --- a/addons/mail/static/src/discuss/call/common/rtc_service.js +++ b/addons/mail/static/src/discuss/call/common/rtc_service.js @@ -189,13 +189,12 @@ export class Rtc { ) { return; } - if (!this.state.selfSession.isMute) { - this.soundEffectsService.play("push-to-talk-off", { volume: 0.3 }); - } - this.state.pttReleaseTimeout = browser.setTimeout( - () => this.setTalking(false), - this.userSettingsService.voiceActiveDuration || 0 - ); + this.state.pttReleaseTimeout = browser.setTimeout(() => { + this.setTalking(false); + if (!this.state.selfSession?.isMute) { + this.soundEffectsService.play("push-to-talk-off", { volume: 0.3 }); + } + }, Math.max(this.userSettingsService.voiceActiveDuration || 0, 200)); }, { capture: true } );