zzarcon/microm

How to stop Microm after recording is finished?

w95 opened this issue ยท 4 comments

w95 commented

How to stop Microm or destroy after recording, because recording icon on tab is not hiding..

I use Chrome 57 on Ubuntu 16

recording
@zzarcon
Thanks

The only way to remove the icon is by stopping the stream. Currently, microm doesn't do that automatically when stopping (nor RecordRTC - and I don't know if that's intended or not).

Created #25 so we can have a low-level access to the stream and use it. For removing the red icon, we would end up with something like this:

let stream, mp3;

function start() {
  microm.record().then(s => {
    stream = s;
    console.log('recording...');
  });
}

function stop() {
  microm.stop().then(result => {
    mp3 = result;
    stream.getAudioTracks().forEach(track => track.stop()); // removes the red icon
  });
}

Should stopRecording() just stop the stream automatically?

stopRecording is a RecordRTC method, and yes, I agree they probably should do it there

There was an issue for it, but the guy solved with a workaround:
muaz-khan/RecordRTC#119

If they don't, maybe microm should do it in the stop method, but as I said above, I'm not sure if the current behavior is intended or not. Let's see what they answer!

@philfreo @buzinas that makes a lot of sense to me, we should stop the stream inside stopRecording ๐Ÿ‘ฏ