From f2dd660889186b97c8c0dadb9aeb1a5279137d31 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Sat, 27 Sep 2025 10:46:48 +0100 Subject: [PATCH] This is a crude but working version that I want to hang onto while the more sophisticated version it still broken. --- japji/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/japji/index.html b/japji/index.html index 3c1250a..383f6f0 100644 --- a/japji/index.html +++ b/japji/index.html @@ -1723,7 +1723,7 @@ (def student-recordings (atom (apply vector (repeat (count data) nil)))) - (defn enable-play-button [phrase-no]) + (defn enable-play-button! [phrase-no]) (defn record-student-sound! [phrase-no] @@ -1732,10 +1732,10 @@ (try (.then (.getUserMedia (.mediaDevices js/navigator) {:audio true}) (fn [arg] - (let [media-recorder (MediaRecorder. arg) + (let [media-recorder (js/MediaRecorder. arg) audio-chunks (atom [])] (.start media-recorder) - (set! media-recorder onerror + (set! (.-onerror media-recorder) (fn [s] (.log js/console (str "Error while recording sound: " s)))) (.addEventListener media-recorder "dataavailable" @@ -1747,7 +1747,7 @@ (js/console.log "data available after MediaRecorder.stop() called.") (if (> (count @audio-chunks) 0) (do - ;; Store the blob in the student-sounds data structure + ;; Store the blob in the student-recordings data structure (swap! student-recordings assoc phrase-no (js/Blob. (clj->js @audio-chunks))) (enable-play-button! phrase-no)))))))) @@ -1801,7 +1801,7 @@ (defn play-student! [phrase-no] - (.play (js/Audio. (.createObjectURL js/URL (@student-sounds phrase-no))))) + (.play (js/Audio. (.createObjectURL js/URL (@student-recordings phrase-no))))) (defn animate-progress-bar! [id duration]