Crash after creating AudioWorkletNode
warpdesign opened this issue · 1 comments
warpdesign commented
The following code crashes when ran in Firefox with audioworklet-polyfill:
this.context.audioWorklet.addModule('js/mod-processor.js').then(() => {
this.workletNode = new AudioWorkletNode(this.context, 'mod-processor');
this.workletNode.port.onmessage = this.handleMessage.bind(this);
// ...
}
Because this.workletNode.port isn't defined.
Looking at the source code of the polyfill, it seems new AudioWorkletNode
returns the ScriptProcessorNode
instead of the AudioWorkletNode
(which has the port
correctly set).
audioworklet-polyfill/src/index.js
Lines 22 to 48 in 4382ddc
Native AudioWorkletNode correctly returns the AudioWorkletNode
object which has the port
property set so the code works as expected here.
developit commented
Ah - whoops, this is an issue with the release that went out 2 days ago. Good catch!