streamproc / MediaStreamRecorder

Cross browser audio/video/screen recording. It supports Chrome, Firefox, Opera and Microsoft Edge. It even works on Android browsers. It follows latest MediaRecorder API standards and provides similar APIs.
https://www.webrtc-experiment.com/msr/
MIT License
2.63k stars 562 forks source link

mediaRecorder.ondataavailable broken #130

Open jhelmbrecht opened 7 years ago

jhelmbrecht commented 7 years ago

mediaRecorder.ondataavailable never fires on any browser.

muaz-khan commented 7 years ago

Minimum timeSlice should be 1000 milliseconds or higher. Did you test this demo?

Please share more information (e.g. browser+OS info + how to reproduce this bug e.g. jsfiddle snippet)

varenc commented 7 years ago

I'm seeing the same thing in some cases. The audio recorder demo here is indeed broken because of this.

When recording only audio (video not selected in the constraints) and mediaRecorder.recorderType = MediaRecorderWrapper thenondataavailable never seems to be called. Changing the constraints to include video fixes this. Different combinations of setting the mimeType and not setting it and including "audioChannels=1" and not doesn't seem to fix this. With some combination, I was able to get ondataavailable to be called once after I triggered .stop() but the resulting data didn't have any video/audio headers in it and can't be played. I assume the earlier ondataavailable events are being swallowed for some reason and in this case all I'm seeing is the end of the file.

varenc commented 7 years ago

I can confirm that in this release ondataavailable seems to work: https://github.com/streamproc/MediaStreamRecorder/releases/tag/1.3.2 (audio demo works in that release)

but sadly in that release the onstop event isn't called. I'm going to try applying the onstop fix to that release though at that point I might just try using MediaRecorder directly.

jhelmbrecht commented 7 years ago

Thanks Chris, I've been traveling so I haven't been able to experiment and debug much. Friday/sat I hope to have a deeper look.

jhelmbrecht commented 7 years ago

What i'm noticing is that when I start my stream with captureUserMedia(mediaConstraints, onMediaSuccess, onMediaError); multiple instances of audio are being processed, and I get an echo. When I stop, i believe it is having trouble ending the multiple streams.

varenc commented 7 years ago

@jhelmbrecht that seems like it's unrelated. The echo effect is intentional and can be disabled. If you're not using MultiStreamRecorder then I don't think you're dealing with multiple streams. The lack of ondataavailable being called in some cases is still a real issue though!