diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-10 19:58:06 -0400 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-10-10 21:30:38 -0400 |
commit | 1d516b3b24eb6b89aa3a345341b6c1c35e24dfed (patch) | |
tree | d32c926ab268f73142f8672ce9b115a5610c04e5 /ext/bg/js/audio.js | |
parent | 8ae1da427756a9a1e057b3518c4069ac7d5b4b3a (diff) |
Implement audio fallbacks
Diffstat (limited to 'ext/bg/js/audio.js')
-rw-r--r-- | ext/bg/js/audio.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js index 26896027..0bf836df 100644 --- a/ext/bg/js/audio.js +++ b/ext/bg/js/audio.js @@ -136,6 +136,7 @@ function audioBuildFilename(definition) { return filename += '.mp3'; } + return null; } async function audioInject(definition, fields, sources, optionsContext) { @@ -157,11 +158,12 @@ async function audioInject(definition, fields, sources, optionsContext) { audioSourceDefinition = definition.expressions[0]; } - const url = await audioBuildUrl(audioSourceDefinition, sources[0], optionsContext); - const filename = audioBuildFilename(audioSourceDefinition); - - if (url && filename) { - definition.audio = {url, filename}; + const {url} = await audioGetFromSources(audioSourceDefinition, sources, optionsContext, false); + if (url !== null) { + const filename = audioBuildFilename(audioSourceDefinition); + if (filename !== null) { + definition.audio = {url, filename}; + } } return true; |