AudioManager add suspend (#2887)

* feat: `AudioManager` add `suspend`
This commit is contained in:
ChenMo
2026-01-28 20:43:13 +08:00
committed by GitHub
parent 6a8058be2e
commit 362c06bb2b

View File

@@ -10,6 +10,14 @@ export class AudioManager {
private static _resumePromise: Promise<void> = null;
private static _needsUserGestureResume = false;
/**
* Suspend the audio context.
* @returns A promise that resolves when the audio context is suspended
*/
static suspend(): Promise<void> {
return AudioManager._context.suspend();
}
/**
* Resume the audio context.
* @remarks On iOS Safari, calling this within a user gesture (e.g., click/touch event handler) can pre-unlock audio and reduce playback delay.