aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/audio.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-10 20:17:01 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-10 21:30:38 -0400
commit27c8430915af0a11a5f0c3216053cf3c5f090c50 (patch)
treec784682e8b902f388321ff0c9ed0457883745e8d /ext/bg/js/audio.js
parent50252ec627eb26515b5ad22a68e615726589aff1 (diff)
Implement custom audio source
Diffstat (limited to 'ext/bg/js/audio.js')
-rw-r--r--ext/bg/js/audio.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index 0bf836df..9e0ae67c 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -85,6 +85,11 @@ const audioUrlBuilders = {
}
throw new Error('Failed to find audio URL');
+ },
+ 'custom': async (definition, optionsContext) => {
+ const options = await apiOptionsGet(optionsContext);
+ const customSourceUrl = options.audio.customSourceUrl;
+ return customSourceUrl.replace(/\{([^\}]*)\}/g, (m0, m1) => (definition.hasOwnProperty(m1) ? `${definition[m1]}` : m0));
}
};