From 2275151382d78a75c2dc2e5f161b1bbedb7d57a7 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Feb 2026 01:29:37 +0000 Subject: [PATCH] fix(demo): show player immediately after loading audio file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unnecessary `ensureRunning()` call from the file input handler. The `change` event from a file input may not qualify as a user activation in some browsers, causing `AudioContext.resume()` to block or fail silently. Since `decodeAudioData` and node creation work on a suspended context, `ensureRunning()` is not needed here — it is already called when the user clicks Play. Also add `console.error` to the catch block for easier debugging. https://claude.ai/code/session_01W4ZqXjt5v7W8B5hmP22Z1P --- demo/src/demo/demo-utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/src/demo/demo-utils.ts b/demo/src/demo/demo-utils.ts index 5fdb096..98ccdce 100644 --- a/demo/src/demo/demo-utils.ts +++ b/demo/src/demo/demo-utils.ts @@ -108,12 +108,12 @@ export function setupFileInputHandler( el.fileLabelText.textContent = i18n.loading; el.fileName.innerHTML = ''; try { - await player.ensureRunning(); initNodes(); const buffer = await player.loadFromBlob(file); el.fileName.textContent = file.name; onLoad(buffer); - } catch { + } catch (e) { + console.error('Failed to load audio file:', e); el.fileName.textContent = i18n.loadFailed; } finally { el.fileLabel.classList.remove('is-loading');