From 58e5ddfde00eb28ac3a12cd2c83c1088a63d7d23 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 9 Sep 2020 21:07:18 -0400 Subject: Generalize AnkiNoteBuilder to not use audioSystem directly (#796) --- ext/mixed/js/audio-system.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext/mixed/js') diff --git a/ext/mixed/js/audio-system.js b/ext/mixed/js/audio-system.js index 07e1a79b..9bf12510 100644 --- a/ext/mixed/js/audio-system.js +++ b/ext/mixed/js/audio-system.js @@ -185,7 +185,11 @@ class AudioSystem { throw new Error('Could not retrieve audio'); } - return arrayBuffer; + return this._arrayBufferToBase64(arrayBuffer); + } + + _arrayBufferToBase64(arrayBuffer) { + return btoa(String.fromCharCode(...new Uint8Array(arrayBuffer))); } _isAudioValid(audio) { -- cgit v1.2.3