summaryrefslogtreecommitdiff
path: root/ext/js/media/audio-downloader.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/media/audio-downloader.js')
-rw-r--r--ext/js/media/audio-downloader.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/js/media/audio-downloader.js b/ext/js/media/audio-downloader.js
index 4e77419b..bb8d40a8 100644
--- a/ext/js/media/audio-downloader.js
+++ b/ext/js/media/audio-downloader.js
@@ -49,9 +49,12 @@ class AudioDownloader {
return [];
}
- async downloadExpressionAudio(sources, expression, reading, details) {
+ async downloadExpressionAudio(sources, preferredAudioIndex, expression, reading, details) {
for (const source of sources) {
- const infoList = await this.getExpressionAudioInfoList(source, expression, reading, details);
+ let infoList = await this.getExpressionAudioInfoList(source, expression, reading, details);
+ if (typeof preferredAudioIndex === 'number') {
+ infoList = (preferredAudioIndex >= 0 && preferredAudioIndex < infoList.length ? [infoList[preferredAudioIndex]] : []);
+ }
for (const info of infoList) {
switch (info.type) {
case 'url':