Browse Source

Support click on/off recording

offline
decentral1se 3 years ago
parent
commit
f9bb10ff1e
No known key found for this signature in database GPG Key ID: 92DAD76BD9567B8A
  1. 11
      voicegardens/static/voicegardens.js

11
voicegardens/static/voicegardens.js

@ -4,6 +4,12 @@
// Voicegardens front-end Javascript // Voicegardens front-end Javascript
// //
// The entire canvas
var _canvas;
// Offline recording duration
var offlineRecordingDuration = 6000;
// URL which exposes the archive saving API end-point // URL which exposes the archive saving API end-point
var archiveUrl = window.location + "add-to-archive"; var archiveUrl = window.location + "add-to-archive";
var archiveListingUrl = window.location + "archive"; var archiveListingUrl = window.location + "archive";
@ -60,6 +66,7 @@ function record() {
getAudioContext().resume(); getAudioContext().resume();
if (microphone.enabled === true) { if (microphone.enabled === true) {
recorder.record(recording); recorder.record(recording);
setTimeout(stop, offlineRecordingDuration);
} }
} }
@ -152,6 +159,8 @@ function setupRecording() {
recording = new p5.SoundFile(); recording = new p5.SoundFile();
canvas.mousePressed(record);
// recordButton = createImg("../static/images/RECORD-COLOR.png"); // recordButton = createImg("../static/images/RECORD-COLOR.png");
// recordButton.mousePressed(record); // recordButton.mousePressed(record);
// recordButton.class("button record"); // recordButton.class("button record");
@ -506,7 +515,7 @@ function setup() {
/** /**
* The initial setup function called once on start. * The initial setup function called once on start.
**/ **/
createCanvas(windowWidth, windowHeight); canvas = createCanvas(windowWidth, windowHeight);
frameRate(frameRate); frameRate(frameRate);
setupRecording(); setupRecording();

Loading…
Cancel
Save