Audio on native

This commit is contained in:
2026-11-22 18:27:01 -03:00
parent a552883795
commit 0d770c7bc4
9 changed files with 790 additions and 10 deletions
+7 -2
View File
@@ -15,8 +15,13 @@ export class WebAudioOutput implements SoundOutput {
#buffers = new WeakMap<Uint8Array, Promise<AudioBuffer | undefined>>();
#volumes: Volumes | undefined;
constructor() {
// browsers keep audio off until the player clicks or presses a key, so it starts then
// browsers keep audio off until the player clicks or presses a key, so it starts then. the desktop app's web audio
// (client/native/web_audio.ts) has no such rule and starts right away
constructor(wait_for_input = true) {
if (!wait_for_input) {
this.#unlock();
return;
}
const unlock = () => {
this.#unlock();
if (this.#context?.state === "running") {