/// import { WebAudioContextManager } from './WebAudioContextManager.js'; import './AudioCache.js'; /** * Get or create the global audio context manager * NOTE: Does NOT create AudioContext yet - that happens during unlock */ declare function getGlobalAudioContext(): WebAudioContextManager; /** * Setup unlock handlers - can be called multiple times safely * * ## When This Is Called * * This function is called in: * * DataCaptureContext.forLicenseKey() - During SDK initialization * * ## Why This Exists * * iOS Safari and modern browsers require user interaction before audio can play * (autoplay policy). This function sets up event listeners for user gestures that * will unlock audio playback. * * ## Event Listener Strategy * * Listens for: touchstart, touchend, click, keydown (same as howler.js) * - Uses capture phase (true) to catch events early * - Removes all listeners after first unlock (one-time setup) * * ## Synchronous vs Asynchronous Operations * * The unlock process has two phases: * * **Phase 1 - Synchronous (in event handler, during user gesture):** * - Create AudioContext (iOS requirement) * - Initiate context.resume() (iOS requirement) * - These MUST happen synchronously or iOS will block audio * * **Phase 2 - Asynchronous (after event handler returns):** * - Wait for resume() to complete * - Play silent scratch buffer to verify unlock * - Create MediaStreamDestination (iOS) * - Mark as unlocked * * ## Why Synchronous Execution is Critical * * iOS Safari only allows certain audio operations during the synchronous * execution of a user event handler. If we wait for promises or use async/await, * the event handler returns and iOS considers the "user gesture context" to be over. * Any audio operations after that point will be silently blocked. */ declare function ensureUnlockSetup(): void; export { ensureUnlockSetup, getGlobalAudioContext };