summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Taylor <jtaylor@classicalconversations.com>2023-10-02 17:50:59 -0400
committerJackson Taylor <jtaylor@classicalconversations.com>2023-10-02 17:50:59 -0400
commit019c5a3466692732f6385965ce435f65a30ce181 (patch)
treeef3667ff303f76c3ed779f1f9267436836d1c562
Initial commitHEADmain
-rw-r--r--audio.mp3bin0 -> 35520 bytes
-rw-r--r--go.mod3
-rw-r--r--index.html28
-rw-r--r--main.go28
4 files changed, 59 insertions, 0 deletions
diff --git a/audio.mp3 b/audio.mp3
new file mode 100644
index 0000000..b2dc4c8
--- /dev/null
+++ b/audio.mp3
Binary files differ
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..9b40fc0
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module github.com/JacksonTaylorxyz/clyde_wavesurfer_test
+
+go 1.21.1
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..1a8d1c4
--- /dev/null
+++ b/index.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <title>Clyde test</title>
+ </head>
+ <body>
+ <p>Something</p>
+ <div id="waveform">
+ <!-- the waveform will be rendered here -->
+ </div>
+
+ <script type="module">
+
+ import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js'
+
+ const wavesurfer = WaveSurfer.create({
+ container: '#waveform',
+ waveColor: '#4F4A85',
+ progressColor: '#383351',
+ url: '/audio.mp3',
+ })
+
+ wavesurfer.on('interaction', () => {
+ wavesurfer.play()
+ })
+ </script>
+ </body>
+</html>
diff --git a/main.go b/main.go
new file mode 100644
index 0000000..c88ae4a
--- /dev/null
+++ b/main.go
@@ -0,0 +1,28 @@
+/*
+Serve is a very simple static file server in go
+Usage:
+
+ -p="8100": port to serve on
+ -d=".": the directory of static files to host
+
+Navigating to http://localhost:8100 will display the index.html or directory
+listing file.
+*/
+package main
+
+import (
+ "flag"
+ "log"
+ "net/http"
+)
+
+func main() {
+ port := flag.String("p", "8100", "port to serve on")
+ directory := flag.String("d", ".", "the directory of static file to host")
+ flag.Parse()
+
+ http.Handle("/", http.FileServer(http.Dir(*directory)))
+
+ log.Printf("Serving %s on HTTP port: %s\n", *directory, *port)
+ log.Fatal(http.ListenAndServe(":"+*port, nil))
+}