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
Currently encodeWav expects a callback that will be passed the blob after a 30ms timeout.
Why is the timeout necessary in a function that appears to be otherwise fully synchronous? I tried swapping the setTimeout for a simple return blob; and it works fine.
Assuming there's some asynchronicity that has to be waited for, why not return a promise that resolves with the blob?
In my use case, I'm encoding many different chunks of audio and then putting the blobs into a zip file for download, so I have to wait for all blobs to be returned. The callback was not a practical solution for me, but maybe other people using this library typically don't have this problem and are okay with the callback solution.
I could submit a PR with a very simple change to promisify encodeWav, but I wanted to understand the library's rationale first.
Thanks!
The text was updated successfully, but these errors were encountered:
Currently
encodeWav
expects a callback that will be passed the blob after a 30ms timeout.Why is the timeout necessary in a function that appears to be otherwise fully synchronous? I tried swapping the
setTimeout
for a simplereturn blob;
and it works fine.Assuming there's some asynchronicity that has to be waited for, why not return a promise that resolves with the blob?
In my use case, I'm encoding many different chunks of audio and then putting the blobs into a zip file for download, so I have to wait for all blobs to be returned. The callback was not a practical solution for me, but maybe other people using this library typically don't have this problem and are okay with the callback solution.
I could submit a PR with a very simple change to promisify
encodeWav
, but I wanted to understand the library's rationale first.Thanks!
The text was updated successfully, but these errors were encountered: