1
0
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:
Marek Farkaš
2024-01-14 14:36:39 +01:00
committed by GitHub
parent 6f2d31626c
commit 5b37848e35
6 changed files with 817 additions and 0 deletions

20
web/stream.js Normal file
View 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;
});