You've already forked fm-dx-webserver
mirror of
https://github.com/KubaPro010/fm-dx-webserver.git
synced 2026-02-26 22:13:53 +01:00
Add files via upload
This commit is contained in:
20
web/stream.js
Normal file
20
web/stream.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const audioElement = document.getElementById("myAudio");
|
||||
const volumeSlider = document.getElementById("volumeSlider");
|
||||
const audioStream = "/audio-proxy";
|
||||
const uniqueTimestamp = Date.now(); // Create a unique timestamp
|
||||
|
||||
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
||||
const audioSource = audioContext.createMediaElementSource(audioElement);
|
||||
|
||||
audioSource.connect(audioContext.destination);
|
||||
|
||||
// Set the audio element's source to your external audio stream
|
||||
audioElement.src = `${audioStream}?${uniqueTimestamp}`;
|
||||
|
||||
|
||||
audioElement.play();
|
||||
|
||||
volumeSlider.addEventListener("input", (event) => {
|
||||
event.stopPropagation();
|
||||
audioElement.volume = volumeSlider.value;
|
||||
});
|
||||
Reference in New Issue
Block a user