aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-09 22:33:35 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-10 21:30:35 -0400
commit8ae1da427756a9a1e057b3518c4069ac7d5b4b3a (patch)
tree45356e700289c2b264e1a406c1984b10574be468 /ext/mixed/js
parent22b218d17238cc003938ef46403596c2183a9c1b (diff)
Update audio options format
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/display.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js
index 78e6d8e3..c1224084 100644
--- a/ext/mixed/js/display.js
+++ b/ext/mixed/js/display.js
@@ -189,7 +189,7 @@ class Display {
addable: options.anki.enable,
grouped: options.general.resultOutputMode === 'group',
merged: options.general.resultOutputMode === 'merge',
- playback: options.general.audioSource !== 'disabled',
+ playback: options.audio.enabled,
compactGlossaries: options.general.compactGlossaries,
debug: options.general.debugInfo
};
@@ -209,7 +209,7 @@ class Display {
const {index, scroll} = context || {};
this.entryScrollIntoView(index || 0, scroll);
- if (this.options.general.autoPlayAudio && this.options.general.audioSource !== 'disabled') {
+ if (this.options.audio.enabled && this.options.audio.autoPlay) {
this.autoPlayAudio();
}
@@ -404,7 +404,7 @@ class Display {
this.setSpinnerVisible(true);
const expression = expressionIndex === -1 ? definition : definition.expressions[expressionIndex];
- let url = await apiAudioGetUrl(expression, this.options.general.audioSource, this.optionsContext);
+ let url = await apiAudioGetUrl(expression, this.options.audio.sources[0], this.optionsContext);
if (!url) {
url = '/mixed/mp3/button.mp3';
}
@@ -413,10 +413,11 @@ class Display {
this.audioCache[key].pause();
}
+ const volume = this.options.audio.volume / 100.0;
let audio = this.audioCache[url];
if (audio) {
audio.currentTime = 0;
- audio.volume = this.options.general.audioVolume / 100.0;
+ audio.volume = volume;
audio.play();
} else {
audio = new Audio(url);
@@ -426,7 +427,7 @@ class Display {
}
this.audioCache[url] = audio;
- audio.volume = this.options.general.audioVolume / 100.0;
+ audio.volume = volume;
audio.play();
};
}