From 059e82344de3763dd22efffeb80693d28842ef17 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Sat, 15 Feb 2020 21:30:49 +0100 Subject: [PATCH] Maybe fix the audio starting thing --- voicegardens/static/voicegardens.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/voicegardens/static/voicegardens.js b/voicegardens/static/voicegardens.js index a5ea52a..efd072f 100644 --- a/voicegardens/static/voicegardens.js +++ b/voicegardens/static/voicegardens.js @@ -61,6 +61,12 @@ function record() { } } +function enableAudioContext() { + if (getAudioContext().state !== "running") { + getAudioContext().resume(); + } +} + function stop() { /** * Stop recording a new sound. @@ -152,6 +158,7 @@ function setupRecording() { recordButton = createImg("../static/images/RECORD-COLOR.png"); recordButton.mousePressed(record); + recordButton.touchPressed(enableAudioContext); recordButton.class("button record"); stopButton = createImg("../static/images/STOP-BW.png");