Skip to content

Commit

Permalink
website/js: add volume slider event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Wessie committed Mar 18, 2024
1 parent 739cdff commit 11fdf50
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions assets/js/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ htmx.on('htmx:load', (event) => {
stream.setButton("Stop Stream");
}
}
// register volume slider
let volume = document.getElementById("stream-volume");
if (volume && !volume.dataset.haslistener) {
volume.dataset.haslistener = true;
volume.value = localStorage.getItem("volume");
volume.addEventListener("input", (ev) => {
vol = parseFloat(ev.target.value) / 100.0;
if (stream) {
stream.setVolume(vol, true);
}
});
}
});

htmx.on('htmx:afterSettle', (event) => {
Expand Down

0 comments on commit 11fdf50

Please sign in to comment.