Fix airband audio element - remove crossorigin, add controls

- Remove crossorigin="anonymous" attribute that may cause CORS issues
- Add controls attribute so user can manually play if autoplay blocked
- Show/hide audio player element when listening starts/stops
- Hide visualizer container on stop

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-15 16:03:51 +00:00
parent 4224418e6f
commit 130bc8a51c

View File

@@ -274,7 +274,7 @@
</div>
</div>
</div>
<audio id="airbandPlayer" style="display: none;" crossorigin="anonymous"></audio>
<audio id="airbandPlayer" controls style="display: none; width: 100%; max-width: 300px; height: 32px; margin-top: 8px;"></audio>
</div>
</main>
@@ -3073,6 +3073,7 @@ sudo make install</code>
document.getElementById('airbandStatus').textContent = frequency.toFixed(3) + ' MHz';
document.getElementById('airbandStatus').style.color = 'var(--accent-green)';
document.getElementById('airbandVisualizerContainer').style.display = 'flex';
document.getElementById('airbandPlayer').style.display = 'block';
} catch (err) {
console.error('[AIRBAND] Error:', err);
@@ -3089,6 +3090,7 @@ sudo make install</code>
const audioPlayer = document.getElementById('airbandPlayer');
audioPlayer.pause();
audioPlayer.src = '';
audioPlayer.style.display = 'none';
fetch('/listening/audio/stop', { method: 'POST' })
.then(r => r.json())
@@ -3098,6 +3100,7 @@ sudo make install</code>
document.getElementById('airbandBtn').classList.remove('active');
document.getElementById('airbandStatus').textContent = 'OFF';
document.getElementById('airbandStatus').style.color = 'var(--text-muted)';
document.getElementById('airbandVisualizerContainer').style.display = 'none';
})
.catch(() => {});
}