ijsnow / studiojs

A collection of tools to create your own in browser recording studio.
MIT License
32 stars 26 forks source link

sometimes Only 44 bytes audio recording #6

Open Gopirengaraj08 opened 5 years ago

Gopirengaraj08 commented 5 years ago

While recording audio in .wav format, sometimes only 44 bytes are recording. I don't know the reason. So kindly help me. I'm using recorder-js in angular6.

huy9x30 commented 5 years ago

I got same problem while using in Chrome v76 and RiotJS. Only got 44 bytes of blob.

cain06 commented 5 years ago

Anyone who is monitoring this - this is directly related to the other issue posted about audio context starting. The solution to this is pretty easy, in the example there is a line like this:

const audioContext = new (window.AudioContext || window.webkitAudioContext)();

Really what you want to do is create the audioContext in your click handler, not as a const. E.g.


var audioContext = null;
$(".record").click(function() {
  if (audioContext == null) {
      audioContext =  new (window.AudioContext || window.webkitAudioContext)();
  }
  // rest of example will work now
});