Fixed playback level meters staying at 0% by resolving React closure issue in the monitoring loop - same pattern as the recording fix. The Problem: - monitorPlaybackLevels callback checked stale `isPlaying` state - Animation loop would run once and never continue - Dependency on isPlaying caused callback recreation on every state change The Solution: - Added isMonitoringLevelsRef to track state independent of React - Removed isPlaying dependency from callback (now has empty deps []) - Set ref to true when starting playback - Set ref to false when pausing, stopping, or ending playback - Animation loop checks ref instead of stale closure state Monitoring State Management: - Start: play() sets isMonitoringLevelsRef.current = true - Stop: pause(), stop(), onended, and cleanup set it to false - Loop: continues while ref is true, stops when false This ensures the requestAnimationFrame loop runs continuously during playback and calculates real-time RMS levels for all tracks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
19 KiB
19 KiB