Commit Graph

15 Commits

Author SHA1 Message Date
Glenn Thompson b29e504bb3 Add pause event handler for muted stream throttling
- Detect when browser pauses muted stream (throttling)
- Auto-reconnect after 3 seconds when paused while muted
- Apply to all three players for consistency
2025-12-12 13:55:55 -05:00
Glenn Thompson 2cd128260c Add robust auto-reconnect to all audio players
- Implement isReconnecting flag to prevent duplicate reconnect attempts
- Add exponential backoff for error retries (3s, 6s, 12s, max 30s)
- Retry indefinitely until stream returns
- Handle error, stalled, and ended events consistently
- Reset state on successful playback
- Apply same logic to frame player, popout player, and front-page player
2025-12-12 13:55:55 -05:00
Brian O'Reilly afa9f2e172 increase the polling interval for #'update-stream-information 2025-12-10 14:57:54 -05:00
Glenn Thompson 6fac97b6e1 Fix ParenScript constructor syntax: use ps:new for class instantiation
Change (new -ClassName) to (ps:new (-ClassName)) for proper ParenScript
macro expansion. Fixes Event and FormData constructors.

Co-authored-by: @easilok
2025-12-10 11:11:32 -05:00
Glenn Thompson b6c1baa473 Implement playlist management MVP for player page
Features:
- Create, view, load, and delete playlists
- Add tracks to playlists via dropdown menu (📋 button)
- View playlist contents (👁️ button)
- Load playlist to queue with auto-play (📂 button)
- Delete playlist with confirmation (🗑️ button)

Backend changes:
- Move get-db-connection-params to database.lisp for proper load order
- Update playlist functions to use playlist_tracks junction table
- Add get-playlist-tracks and get-playlist-track-count functions
- Add delete and remove-track API endpoints
- Fix stream-track endpoint to not wrap errors in JSON

Frontend changes (ParenScript):
- Add playlist display with action buttons
- Add showAddToPlaylistMenu dropdown
- Add deletePlaylist and viewPlaylist functions
- Fix forEach chaining with progn
- Fix let* scoping for sequential bindings
- Fix ps:regex syntax for string escaping
- Add console logging for playlist debugging
2025-12-10 11:11:32 -05:00
Glenn Thompson 135a6a8dee Apply easilok's ParenScript fixes and fix playlist creation
ParenScript player.lisp fixes (from easilok):
- Replace == with = for JavaScript equality
- Replace inner-html with inner-h-t-m-l
- Replace parseInt with parse-int
- Replace let with let* where needed for sequential bindings
- Replace new "FormData" with new -Form-data
- Fix audio event listener chaining
- Replace Promise chains with setTimeout callbacks

playlist-management.lisp:
- Remove track-ids field (column doesn't exist, using junction table)
2025-12-10 11:11:32 -05:00
Glenn Thompson 22b2a2d87e Add Liquidsoap/Icecast controls, fix library scan
- Add Liquidsoap control panel: status display, skip track, reload playlist, restart container
- Add Icecast restart button to System Status section
- Remove redundant Web Player Control section from admin
- Fix music library scan to follow symlinks (truename resolution)
- Fix database timestamp error (let PostgreSQL default handle added-date)
- Update docker-compose mount for stream-queue.m3u
- Clean up playlist path handling
2025-12-10 11:11:32 -05:00
Glenn Thompson 74a9448e9a Fix player.js bugs and update admin panel
- Remove Live Stream Monitor section (redundant with frame player)
- Fix player.lisp pagination start-index calculation
- Fix track property access (remove erroneous index 0)
- Fix if/else paren structure in play-next function
- Fix indentation in play-track function
- Update Music Library Management section to reflect Docker setup
- Add geostationary playlist file
2025-12-10 11:11:32 -05:00
Glenn Thompson c89e31b998 Add geo stats collection and improve admin dashboard UI
- Add geo IP lookup for listener locations (ip-api.com)
- Add geo stats table with country flags to admin dashboard
- Fix listener stats table alignment with proper centering
- Fix Now Playing display to update without requiring audio playback
- Add caching for geo lookups to reduce API calls
2025-12-10 11:11:32 -05:00
Glenn Thompson 8c19e0fbde Fix wedged player with reconnect button and volume preservation
- Add reconnect button (🔄) to frameset player bar
- Recreate audio element on reconnect to fix wedged MediaElementSource
- Properly close and reinitialize AudioContext for spectrum analyzer
- Preserve volume and muted state when reconnecting
- Show status messages for connection issues
- Reduce Now Playing update interval to 5 seconds
- Add front-page.js to player-content.ctml for Now Playing updates
- Create About pages (about.ctml and about-content.ctml)
- Add About link to navigation in both modes
2025-12-10 11:11:32 -05:00
Glenn Thompson 2fa03e447a Update dropdown colors to match spectrum analyzer theme
- Dropdown boxes now dynamically update their text and border colors to match selected theme
- Prevents color clashing between UI elements and spectrum analyzer
- Colors update both on theme change and on page load
2025-12-06 11:55:24 -05:00
Glenn Thompson c08b5f73de Add monotone theme and dynamic border color
- Add monotone theme with deep blue to cobalt gradient
- Update canvas border color dynamically to match selected theme
- Set initial border color on page load based on saved preference
2025-12-06 11:55:24 -05:00
Glenn Thompson 51387bddba Add spectrum analyzer theming and visualization styles
- Add 6 color themes: green, blue, purple, red, amber, rainbow
- Add 3 visualization styles: bars, wave, dots
- Add UI controls (dropdowns) to change theme and style
- Persist user preferences in localStorage
- Remove debug logging from parenscript serving and Icecast stats
- Fix dots visualization with proper Math.PI handling
2025-12-06 11:55:24 -05:00
Glenn Thompson b6be0ebab1 feat: Convert JavaScript to Parenscript with stream fixes and UX improvements
Major Changes:
- Convert all JavaScript files to Parenscript for better maintainability
- Move spectrum-analyzer to parenscript/ directory structure
- Add parenscript-utils.lisp for shared utilities
- Convert admin.js, player.js, front-page.js, auth-ui.js to Parenscript
- Convert profile.js, users.js, recently-played.js to Parenscript

Stream Reconnect Fixes (from merged PR):
- Add reset-spectrum-analyzer function to properly clean up Web Audio API
- Implement reconnect logic for pauses longer than 10 seconds
- Detect stale audio in 'playing' event and force stream reconnection
- Prevent 'Now Playing' updates while stream is paused
- Reduce reconnect delay to 200ms for faster response
- Add proper spectrum analyzer reset/reinit during reconnection

UX Improvements:
- Change live indicator from blink to smooth pulse (2s ease-in-out)
- Pulse animation like old PowerBook/MacBook sleep indicator
- Add MUTED indicator to spectrum analyzer when audio is muted
- Spectrum continues to flow even when muted (data still streaming)
- Red 'MUTED' text displayed in top-right corner of canvas

Technical Details:
- Parenscript files generate JavaScript via API endpoints
- All player modes updated: main player, front page, popout, frame player
- Improved audio context handling to only create once per element
- Added comprehensive error handling and logging
- Updated asteroid.asd to include parenscript module structure

Documentation:
- Updated all documentation dates to 2025-12-06
- Added PARENSCRIPT-EXPERIMENT.org documenting the conversion
- Updated PROJECT-HISTORY.org with Phase 9 (Visual Audio Features)
- Added comprehensive project statistics (408 commits, 9,300 LOC)

This conversion improves code maintainability by using Lisp throughout
the stack and makes it easier to share code between frontend and backend.
2025-12-06 11:55:24 -05:00
Glenn Thompson 7c7b2c921e fix: Prevent stale audio playback after long pause and reorganize spectrum analyzer
- Detect pauses longer than 10 seconds across all player modes
- Intercept 'playing' event to stop stale buffered audio
- Force stream reconnect to get live audio after long pause
- Reset and reinitialize spectrum analyzer during reconnect
- Prevent 'Now Playing' updates while stream is paused
- Move spectrum-analyzer.lisp to parenscript/ directory
- Update all documentation dates to 2025-12-06
- Add comprehensive project statistics (408 commits, 9,300 LOC)
- Add Phase 9 (Visual Audio Features) to project history

Fixes issue where resuming playback after a long pause would play
old buffered audio instead of the current live stream. The fix uses
the 'playing' event to detect when stale audio starts and immediately
stops it, then reconnects to get fresh stream data.

All player modes updated: main player, front page, popout, and frame player.
2025-12-06 08:36:30 -05:00