From 6a324cb2c22853d90dbfa73416913eefd0b39d1c Mon Sep 17 00:00:00 2001 From: Geir Eilertsen Date: Tue, 10 Dec 2024 16:30:23 +0100 Subject: [PATCH] Added audiorecorder html file #6 --- .../HumanInteractionsController.java | 8 +- .../main/resources/static/audiorecorder.html | 76 +++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 marvin.interaction.web/src/main/resources/static/audiorecorder.html diff --git a/marvin.interaction.web/src/main/java/com/assetvisor/marvin/interaction/web/controllers/HumanInteractionsController.java b/marvin.interaction.web/src/main/java/com/assetvisor/marvin/interaction/web/controllers/HumanInteractionsController.java index 36faf6f..38a7911 100644 --- a/marvin.interaction.web/src/main/java/com/assetvisor/marvin/interaction/web/controllers/HumanInteractionsController.java +++ b/marvin.interaction.web/src/main/java/com/assetvisor/marvin/interaction/web/controllers/HumanInteractionsController.java @@ -21,17 +21,17 @@ public class HumanInteractionsController { private AudioBuffer audioBuffer; @PostMapping("/message") - public void chat(@RequestParam(value = "message") String message) { + public void message(@RequestParam(value = "message") String message) { listenUseCase.listenTo(message); } - @PostMapping("/speech") - public void chat(@RequestBody byte[] message) { + @PostMapping(path = "/speech", consumes = "application/octet-stream") + public void speech(@RequestBody byte[] message) { listenUseCase.listenTo(message); } @GetMapping("/speech") - public ResponseEntity chat() { + public ResponseEntity speech() { byte[] audioData = audioBuffer.get(); if (audioData == null || audioData.length == 0) { diff --git a/marvin.interaction.web/src/main/resources/static/audiorecorder.html b/marvin.interaction.web/src/main/resources/static/audiorecorder.html new file mode 100644 index 0000000..081c639 --- /dev/null +++ b/marvin.interaction.web/src/main/resources/static/audiorecorder.html @@ -0,0 +1,76 @@ + + + + + + Audio Recorder + + +

Audio Recorder

+ + +

Press "Start Recording" to begin.

+ + + +