From 4018f9572329a466612e155317bd04d05220f413 Mon Sep 17 00:00:00 2001 From: Smittix Date: Thu, 15 Jan 2026 15:35:02 +0000 Subject: [PATCH] Fix squawk button to use existing modal, fix airband audio playback - Use existing showSquawkInfo() for squawk button instead of custom modal - Fix airband audio by waiting for canplay event before calling play() - Add proper audio state reset before starting new stream - Remove unused showSquawkReference function Co-Authored-By: Claude Opus 4.5 --- templates/adsb_dashboard.html | 88 ++++++----------------------------- 1 file changed, 15 insertions(+), 73 deletions(-) diff --git a/templates/adsb_dashboard.html b/templates/adsb_dashboard.html index dcee4b4..c07b340 100644 --- a/templates/adsb_dashboard.html +++ b/templates/adsb_dashboard.html @@ -68,7 +68,7 @@ SESSION
- - -
-
-

🚨 Emergency Codes

-
-
7500HIJACKAircraft being hijacked - do not acknowledge
-
7600RADIO FAILTwo-way radio communication failure
-
7700EMERGENCYGeneral emergency (mayday/pan-pan)
-
-
-
-

⚠️ Special Codes

-
-
7777MIL INTERCEPTActive military intercept operations
-
0000DISCRETEMilitary/special operations
-
5000MILITARY UKUK military low-level operations
-
0033PARA OPSParachute dropping operations
-
-
-
-

✈️ Standard VFR/IFR

-
-
1200VFR (US/CA)Visual flight rules - North America
-
7000VFR (EU)Visual flight rules - ICAO/Europe
-
2000CONSPICUITYEntering airspace, no code assigned
-
1000IFR (EU)Instrument flight rules, no assigned code
-
-
-
-

📋 Other Codes

-
-
4000FERRYAircraft delivery/repositioning
-
7001VFR INTRUSIONVFR aircraft entering controlled space
-
7004AEROBATICAerobatic display flight
-
7010RADIO EQUIPPEDIFR flight (UK zones)
-
-
-
- - `; - document.body.appendChild(modal); - - // Close button handler - modal.querySelector('.squawk-close').addEventListener('click', () => modal.remove()); - - // Click outside to close - modal.addEventListener('click', (e) => { - if (e.target === modal) modal.remove(); - }); - } - // ============================================ // FLIGHT LOOKUP // ============================================ @@ -1989,9 +1923,6 @@ ACARS: ${r.statistics.acarsMessages} messages`; // Auto-connect to gpsd if available autoConnectGps(); - - // Squawk button event listener - document.getElementById('squawkBtn').addEventListener('click', showSquawkReference); }); // Track which device is being used for ADS-B tracking @@ -3094,6 +3025,11 @@ sudo make install // Start browser audio playback const audioPlayer = document.getElementById('airbandPlayer'); + + // Stop any existing playback first + audioPlayer.pause(); + audioPlayer.currentTime = 0; + audioPlayer.src = '/listening/audio/stream?' + Date.now(); // Apply current volume setting @@ -3103,9 +3039,15 @@ sudo make install // Initialize visualizer before playing initAirbandVisualizer(); - audioPlayer.play().catch(e => { - console.warn('Audio autoplay blocked:', e); - }); + // Wait for audio to be ready before playing + audioPlayer.oncanplay = function() { + audioPlayer.play().catch(e => { + console.warn('Audio playback issue:', e); + document.getElementById('airbandStatus').textContent = 'AUDIO BLOCKED'; + document.getElementById('airbandStatus').style.color = 'var(--accent-orange)'; + }); + audioPlayer.oncanplay = null; + }; document.getElementById('airbandBtn').innerHTML = ' STOP'; document.getElementById('airbandBtn').classList.add('active');