muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.49k stars 1.75k forks source link

MediaStreamRecorder audio playback out of sync with video in Chrome/Mac #738

Closed jhned closed 3 years ago

jhned commented 3 years ago

I'm experiencing some audio latency with Google Chrome on Mac. Tested Mac versions are 10.15.5, 10.14.6, and 11.2.3. Chrome version is 89.0.4389. Bug is reproducable on the demo page here: https://www.webrtc-experiment.com/RecordRTC/simple-demos/video-recording.html.

marcuzy commented 3 years ago

It needs some delay between mediaDevices.getUserMedia() and startRecording(). In this example https://webrtc.github.io/samples/src/content/getusermedia/record/ (using MediaRecorder directly) there is no audio latency, since getUserMedia is calling at application start. Experimentally, I found out that 2 seconds is enough.

jhned commented 3 years ago

Excellent, thanks!

qualitymanifest commented 3 years ago

@marcuzy thank you so much, this issue had been driving me crazy and your suggestion fixed it. Strangely enough, I also found that if you are using the built-in mac screen recorder at the same time, it also fixes the issue. Obviously that is not a solution, just a funny anecdote.