added multi sound-channel
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user