Ads play once on channel 11, separate from music

- Add dedicated ad playback system (no loop, own channel)
- Ad channel defaults to 11, saved/loaded with audio settings
- Separate play_ad/stop_ad methods and API endpoints
- Frontend stop button now calls /api/ads/stop instead of stopMusic

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-06 22:35:07 -07:00
parent aa3899b1fc
commit 9452b07c5c
3 changed files with 104 additions and 5 deletions

View File

@@ -131,7 +131,7 @@ function initEventListeners() {
// Ads
document.getElementById('ad-play-btn')?.addEventListener('click', playAd);
document.getElementById('ad-stop-btn')?.addEventListener('click', stopMusic);
document.getElementById('ad-stop-btn')?.addEventListener('click', stopAd);
// Settings
document.getElementById('settings-btn')?.addEventListener('click', async () => {
@@ -686,6 +686,10 @@ async function playAd() {
});
}
async function stopAd() {
await fetch('/api/ads/stop', { method: 'POST' });
}
// --- Sound Effects (Server-Side) ---
async function loadSounds() {