Skip to content

support "blob:..." urls in AudioContext.audioWorklet.addModule #102

Description

@smalia2001

I used realtime-bpm-analyzer with web-audio-api and had to patch the AudioWorklet.#readModule (in src/AudioWorklet.js) method to support blob: urls

it was a simple change:

       return meta.includes('base64') ? atob(body) : decodeURIComponent(body)
     }
 
+    if (url.startsWith('blob:')) {
+      return await fetch(url).then(res => res.text())
+    }
+
     // Dynamic import fs/path — works in Node.js, throws in browser
     let fs, path
     try { fs = await import('fs'); path = await import('path') } catch {

I tested it with Bun v1.3.5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions