diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-06-21 15:51:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-21 15:51:36 -0400 |
commit | 9e28db6ef7df990ee035b5e191727f8c0d3d3139 (patch) | |
tree | 45b9b33ddeb628663ec8ffff4705914376535083 | |
parent | 713bf293778d0172c1eb176b9f07780064896908 (diff) |
Safely handle volume values that are out of range (#617)
-rw-r--r-- | ext/mixed/js/display.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 380134ad..90fd1037 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -807,9 +807,10 @@ class Display { this._stopPlayingAudio(); + const volume = Math.max(0.0, Math.min(1.0, this.options.audio.volume / 100.0)); this.audioPlaying = audio; audio.currentTime = 0; - audio.volume = this.options.audio.volume / 100.0; + audio.volume = Number.isFinite(volume) ? volume : 1.0; const playPromise = audio.play(); if (typeof playPromise !== 'undefined') { try { |