diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-04-17 17:48:55 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-04-18 14:23:34 -0400 |
commit | fcbfde506abf6ca3474d2dfdf4f337b86b0bb579 (patch) | |
tree | cd1103883022a3feb48225347f02eb121c5a120e /ext/mixed/js/display.js | |
parent | 9fe7b9ad29958b148162bfc2d065a7e32a986291 (diff) |
Await and handle errors from audio.play()
Diffstat (limited to 'ext/mixed/js/display.js')
-rw-r--r-- | ext/mixed/js/display.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index f30a65e6..b4a93d99 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -823,7 +823,14 @@ class Display { this.audioPlaying = audio; audio.currentTime = 0; audio.volume = this.options.audio.volume / 100.0; - audio.play(); + const playPromise = audio.play(); + if (typeof playPromise !== 'undefined') { + try { + await playPromise; + } catch (e2) { + // NOP + } + } } catch (e) { this.onError(e); } finally { |