summaryrefslogtreecommitdiff
path: root/ext/mixed/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-09 12:28:48 -0400
committerGitHub <noreply@github.com>2020-05-09 12:28:48 -0400
commit9900291b073bb2b6495cae0993138c26970815a3 (patch)
tree45a289b141deff3c41c995483d318bbe63211c37 /ext/mixed/js
parent69c783f86114329db175135a136c5567ee3e790f (diff)
Fix not awaiting the AudioSystem.arrayBufferDigest promise (#524)
Diffstat (limited to 'ext/mixed/js')
-rw-r--r--ext/mixed/js/audio-system.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/mixed/js/audio-system.js b/ext/mixed/js/audio-system.js
index 4b4d9765..fdfb0b10 100644
--- a/ext/mixed/js/audio-system.js
+++ b/ext/mixed/js/audio-system.js
@@ -173,9 +173,9 @@ class AudioSystem {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.responseType = 'arraybuffer';
- xhr.addEventListener('load', () => {
+ xhr.addEventListener('load', async () => {
const arrayBuffer = xhr.response;
- if (!this._isAudioBinaryValid(arrayBuffer)) {
+ if (!await this._isAudioBinaryValid(arrayBuffer)) {
reject(new Error('Could not retrieve audio'));
} else {
resolve(arrayBuffer);
@@ -195,8 +195,8 @@ class AudioSystem {
);
}
- _isAudioBinaryValid(arrayBuffer) {
- const digest = AudioSystem.arrayBufferDigest(arrayBuffer);
+ async _isAudioBinaryValid(arrayBuffer) {
+ const digest = await AudioSystem.arrayBufferDigest(arrayBuffer);
switch (digest) {
case 'ae6398b5a27bc8c0a771df6c907ade794be15518174773c58c7c7ddd17098906': // jpod101 invalid audio
return false;