sb2702 / audioRecord.js

Easily record audio in the browser, export as WAV, MP3 or OGG
MIT License
57 stars 14 forks source link

Failure when trying to make to or more recordings using the same recorder object #4

Open photz opened 8 years ago

photz commented 8 years ago

Hi, first of all, thanks a million for this project! It's saved me a lot of pain and I've begun using it on my site. There's just one issue that I noticed: while the first recording is flawless, every other recording that follows will be plain silence, if the same recorder object is used. This seems to apply to all wav, mp3 and ogg files. This happens in my own project as well as in the example in the repo. Any idea what might be causing this? I use Firefox 42.0.

Zerquix18 commented 8 years ago

@photz Can you give an example of the code that doesn't work ok?

photz commented 8 years ago

Thanks for responding. If I clone the repository, point my browser to example/index.html, and make a number of recordings, then only the first mp3/ogg contains any sound. The remaining files are silent. Nothing shows up in the console. Replacing exportMP3() for exportWAV() yields the same (nothing). Can you reproduce this?

AndrewBelt commented 8 years ago

Not sure if it's the same problem, but due to a bug in Firefox, the audio source created by the navigator.getUserMedia call gets garbage collected. Here is a workaround to use inside the callback.

    var stream = audio_context.createMediaStreamSource(stream);
    callback(new RecorderObject(stream, cfg));
    window.source = stream;