chrisguttandin / recorder-audio-worklet

This module provides a loader for the RecorderAudioWorkletProcessor and the corresponding RecorderAudioWorkletNode.
MIT License
24 stars 0 forks source link

Princess (encoderPort) is in another Castle! #220

Open yishengjiang99 opened 4 years ago

yishengjiang99 commented 4 years ago

After adding added 1567 packages from 1550 contributors and audited 1571 packages in 43.417s....

405M recorder-audio-worklet 394M recorder-audio-worklet-processor

when it finally sends an AU across process function, what you find at the end of the tunnel is:return false; because this._encoderPort = null;

This a wrapper library that provides an incredibly well-configured package (or two packages) for an encoderPort that does not exist.

for testing they used ` encoderPort = { close: spy(), onmessage: null, postMessage: spy() };

chrisguttandin commented 4 years ago

Hi @yishengjiang99,

I'm not sure what this is. Just in case you want to report an actual issue...

npm i recorder-audio-worklet installs about 20 MB in your node_modules folder and recorder-audio-worklet-processor is already a part of that. However only a fraction of that ends up in the browser.

It would be helpful to know what you tried and what triggered the error.

yishengjiang99 commented 4 years ago

But the actual encoderPort referenced from worklet-processor is in neither of those packages..

Sent from my iPhone

On Oct 20, 2020, at 2:31 PM, Christoph Guttandin notifications@github.com wrote:

 Hi @yishengjiang99,

I'm not sure what this is. Just in case you want to report an actual issue...

npm i recorder-audio-worklet installs about 20 MB in your node_modules folder and recorder-audio-worklet-processor is already a part of that. However only a fraction of that ends up in the browser.

It would be helpful to know what you tried and what triggered the error.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

chrisguttandin commented 4 years ago

Yes, that's intended. It's a parameter of the record() method. It needs to be passed in from outside. It's the port where the data gets send to.

Since there is no documentation yet, here is how I use this package myself:

This is how you can load the worklet code: https://github.com/chrisguttandin/extendable-media-recorder/blob/master/src/factories/web-audio-media-recorder.ts#L20-L26

This is creating a RecorderAudioWorkletNode on the main thread: https://github.com/chrisguttandin/extendable-media-recorder/blob/master/src/factories/web-audio-media-recorder.ts#L36

And here is the call to record() which starts the recording. That's the function which expects to be called with a MessagePort (aka the encoderPort): https://github.com/chrisguttandin/extendable-media-recorder/blob/master/src/factories/web-audio-media-recorder.ts#L131

And this is how you can stop it again: https://github.com/chrisguttandin/extendable-media-recorder/blob/master/src/factories/web-audio-media-recorder.ts#L88

yishengjiang99 commented 4 years ago

Did not realize you are also the author of Standardized-audio-context.., holy shit.