GoogleChromeLabs/audioworklet-polyfill

audioWorklet is not defined - Chrome Android 73

JohnWeisz opened this issue · 2 comments

This is a strange one I picked up today, it seems (my) Chrome Android 73 implementation does define AudioWorkletNode, but not AudioContext.audioWorklet, as if it was an incomplete implementation. However, this polyfill only checks for AudioWorkletNode, and thus there is a runtime error.

The solution I came up was the following, on https://github.com/GoogleChromeLabs/audioworklet-polyfill/blob/master/src/index.js#L22

if (typeof AudioWorkletNode !== 'function' || !("audioWorker" in AudioContext.prototype)) {

Upon further investigation it seems this issue was in fact not originating from an incomplete implementation, but from using a non-secure origin instead (developing over network, and AudioWorklet requires a secure context). The error wasn't useful, the API was simply not made available.

Regardless, I'll leave the PR open in case it's deemed useful.

Thank you, I ran into this as well. I hate it when they magically make stuff disappear on insecure origins, ran into navigator.requestMIDIAccess disappearing as well. This is not very helpful for new developers since all is well on localhost and as soon as you try to put it online nothing works anymore because of this kind of BS. This is NOT how you fix security issues because they can still make those malicious sites under https.