From 347756909a099d9cac9d28bfeec7dbd77373e901 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Tue, 28 Sep 2021 13:28:08 +0000 Subject: [PATCH] [FIX] mail: fix crash when trying to catch result of play() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some browsers don't return a promise from mediaElement.play(), we wrap it in promise.resolve to solve the issue. closes odoo/odoo#77368 X-original-commit: 50898870067d05fb01722487dc2d63a1a5155c7d Signed-off-by: Sébastien Theys (seb) --- addons/mail/static/src/models/sound_effect/sound_effect.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/static/src/models/sound_effect/sound_effect.js b/addons/mail/static/src/models/sound_effect/sound_effect.js index c09dd912121..1c3ae6effa7 100644 --- a/addons/mail/static/src/models/sound_effect/sound_effect.js +++ b/addons/mail/static/src/models/sound_effect/sound_effect.js @@ -30,7 +30,7 @@ function factory(dependencies) { this.audio.currentTime = 0; this.audio.loop = loop; this.audio.volume = volume; - this.audio.play().catch(()=>{}); + Promise.resolve(this.audio.play()).catch(()=>{}); } /**