chrisguttandin / extendable-media-recorder

An extendable drop-in replacement for the native MediaRecorder.
MIT License
258 stars 13 forks source link

It have js version like extendable-media-recorder.js? #663

Open ruon1804 opened 2 years ago

ruon1804 commented 2 years ago

Hi Chris, I'm having a hard time using the MediaRecorder API, I was happy to find your library, but it seems to only work with node.js. I have a project with .Netcore 3.1, can you build a javascript version? It's like extendable-media-recorder.js or something like that. thank you very much.

chrisguttandin commented 2 years ago

Hi @ruon1804,

the library is meant to run in the browser. It doesn't work with Node.js. But Node.js is currently required to bundle the library for the browser.

However it's possible to use a 3rd party service for that as well. Would the following work for you?

https://github.com/chrisguttandin/extendable-media-recorder/issues/651#issuecomment-968819476

ruon1804 commented 2 years ago

Thanks for your respond. I tried following that thread, but it gives me the following error:

Uncaught SyntaxError: The requested module 'https://dev.jspm.io/npm:extendable-media-recorder' does not provide an export named 'MediaRecorder'.

Can you check it again?

chrisguttandin commented 2 years ago

Oh, they must have changed something in the way they process the code on the server. The following seems to work.

<script type="module">
    import extendableMediaRecorder from 'https://dev.jspm.io/npm:extendable-media-recorder';
    import extendableMediaRecorderWavEncoder from 'https://dev.jspm.io/npm:extendable-media-recorder-wav-encoder';

    const { MediaRecorder, register } = extendableMediaRecorder;
    const { connect } = extendableMediaRecorderWavEncoder;

    // ...
</script>
bachvtuan commented 1 year ago

@chrisguttandin I tried to code your code in the browser but I get this error:

 Uncaught SyntaxError: The requested module 'https://dev.jspm.io/npm:extendable-media-recorder' does not provide an export named 'default' (at test3.html:12:16)

I also detect that the browser loads 49 relevant js files. could you some how build a single js file for extendableMediaRecorder and extendableMediaRecorderWavEncoder ?

chrisguttandin commented 1 year ago

Hi @bachvtuan, looks like JSPM handles packages differently now. The following should work.

<script type="module">
    import { MediaRecorder, register } from 'https://dev.jspm.io/npm:extendable-media-recorder';
    import { connect } from 'https://dev.jspm.io/npm:extendable-media-recorder-wav-encoder';

    // ...
</script>

Providing a fully bundled file is something I want to do again. I just had no time for doing it so far.