You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm not sure if that is even an issue, but it took me a while to understand the difference between the Browser based implementation and the one used by node (electron). So I figured others might run into this very specific case as well:
In a nutshell this is the actual runtime difference: Bytes.getData() returns ArrayBuffer in the browser but Buffer in node (electron):
Hi! I'm not sure if that is even an issue, but it took me a while to understand the difference between the Browser based implementation and the one used by node (electron). So I figured others might run into this very specific case as well:
In a nutshell this is the actual runtime difference:
Bytes.getData()
returnsArrayBuffer
in the browser butBuffer
in node (electron):If you're interested - first the JavaScript runtime error I ran into:
This is my little handler causing problems where _audioContext is an
AudioContext
instance:This is my bytes receiving handler, which extracts the needed
ArrayBuffer
and forwards it:So if I use Google Chrome and Http to load the bytes it works fine:
BUT if I use the File API to read the bytes, decoding audio throws the TypeError:
After some research I figured out, that running node (electron),
Bytes.getData()
actually returns ajs.node.Buffer
instance:So in my case I had to convert the node buffer into an array buffer, which led me to this quite old stack overflow answer:
https://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer/31394257#31394257
Just in case you need that:
So is Bytes.getData() not consistent on all platforms?
Is this expected behaviour?
Or is this just a very rare edge case?
The text was updated successfully, but these errors were encountered: