added multi sound-channel

This commit is contained in:
2026-02-16 21:46:32 +01:00
parent 434abad282
commit bb71f893e5
5 changed files with 102 additions and 18 deletions
+5 -1
View File
@@ -60,6 +60,8 @@ function initSoundboard() {
playButtons.forEach(btn => {
btn.addEventListener('click', async () => {
const soundId = btn.dataset.soundId;
const channel = btn.dataset.channel || null;
const loopFlag = btn.dataset.loop === '1' || btn.dataset.loop === 'true';
// Alten Play-Button zurücksetzen
if (currentSoundButton && currentSoundButton !== btn) {
@@ -77,7 +79,7 @@ function initSoundboard() {
const res = await fetch('/api/play_sound', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ sound_id: soundId })
body: JSON.stringify({ sound_id: soundId, channel, loop: loopFlag })
});
const data = await res.json();
@@ -111,10 +113,12 @@ function initSoundboard() {
// ── Stop-Button für aktuellen Sound ────────────────────────────────────────
document.querySelectorAll('.stop-sound-btn').forEach(btn => {
btn.addEventListener('click', async () => {
const channel = btn.dataset.channel || null;
try {
const res = await fetch('/api/stop_sound', {
method: 'POST',
headers: { 'Content-Type': 'application/json' }
,body: JSON.stringify({ channel })
});
const data = await res.json();