aboutsummaryrefslogtreecommitdiff
path: root/static/music_player.js
diff options
context:
space:
mode:
authorSamuel Johnson <[email protected]>2025-05-04 00:25:10 -0400
committerSamuel Johnson <[email protected]>2025-05-04 00:25:10 -0400
commit3abe2c3fbe95ab0a38045c359b808fadac6220ea (patch)
tree6cd22a874eb06fb76c588c8431ed73022b81086f /static/music_player.js
parent005a588111e6d27b012bc923c39d97a6129f39f2 (diff)
Create music player GUI
Diffstat (limited to 'static/music_player.js')
-rw-r--r--static/music_player.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/static/music_player.js b/static/music_player.js
new file mode 100644
index 0000000..8d84774
--- /dev/null
+++ b/static/music_player.js
@@ -0,0 +1,16 @@
+async function mpFetchAsync (url) {
+ let response = await fetch(url);
+ let data = await response.json();
+
+ return data;
+}
+
+const trackList = await mpFetchAsync("/audio");
+let trackSelector = document.getElementById("mp_tracks");
+
+trackList.forEach((track) => {
+ let option = document.createElement("option");
+ option.text = track;
+
+ trackSelector.add(option, 0);
+});