From cc084c4f96e0117e4c7b80dc870f4ac2f6a60035 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 5 Jan 2024 00:38:53 +0100 Subject: autoplay newly recorded clip when option checked --- app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index f567987..a761769 100644 --- a/app.js +++ b/app.js @@ -36,12 +36,18 @@ function onGetDeviceSuccess(stream) { const blob = new Blob(recordingChunks, { type: mediaRecorder.mimeType }); recordingChunks = []; const audioElement = audioElementForBlob(blob); - // TODO: autoplay audioElement if checkbox enabled + // TODO: record blob and list to local persistent storage // TODO: "clear all" button to clear all clips // TODO: buttons to clear individual clips // TODO: keyboard shortcut to play clips for the ten last indexes + clips.prepend(wrapElement("li", audioElement)); + + if (autoplayCheckbox.checked) { + // TODO: stop playing any other clip + audioElement.play(); + } }); recordBtn.addEventListener("mousedown", _event => { -- cgit v1.2.3