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.53k stars 1.75k forks source link

stopRecording not calling callback #63

Closed amorino closed 7 years ago

amorino commented 8 years ago

I'm using RecordRTC as the example, however, the stopRecording function is not calling the callback function.

The following messages are displaying:

initializing video stream recorder message started recording video stream. Stopped recording video stream.

But that's all. I'm using TweenMax and I get the following warning when I load RecordRTC:

'webkitRequestAnimationFrame' is vendor-specific. Please use the standard 'requestAnimationFrame' instead.

Hope that helps.

thierry2015 commented 7 years ago

I currently have the same issue, the callback is not called sometimes. I tried to isolate a typic case, the only one that I found was when stopRecording() was called less than 500ms after startRecording(), but the problem is still happening "randomly" for other cases. (I currently cannot isolate part of the problem)

I currently have a website that relies on this feature, I will continue to investigate the problem, but an update would be welcomed!

cdanzig commented 7 years ago

I have also gotten reports of the stopRecording callback not firing in Chrome. Have yet to reproduce.

karls commented 7 years ago

I have also stumbled on the same issue as previous posters.

I have an external monitor (Thunderbolt display), which I use as my sole monitor most of the time -- laptop lid is closed. I can seemingly reproduce this behaviour when I select the Thunderbolt's camera, but Default or Built-in microphone (not Thunderbolt's own microphone). Having said that, this behaviour has also happened without using the external monitor, while working on the laptop.

I have noticed that when this behaviour (callback not getting called) happens, it is accompanied by ~1-2s freeze in the recorder initialisation. After that, the video starts, but then hangs again for a few seconds. When I stop the video, stream gets stopped, but the callback does not fire.

It looks like when there are multiple video/audio devices available and the "wrong" ones are selected, bad things happen. But given that this weird behaviour has also happened with just one camera and one microphone available, perhaps there is a deeper issue with how Chrome handles selecting media devices?

@muaz-khan any thoughts on this?

mauliksoni110 commented 7 years ago

I am also facing the same, any workaround?

karls commented 7 years ago

@mauliksoni110 the "workaround" is to choose the correct device(s) before initialising the recorder. Unfortunately I don't yet know if or how this can be done programmatically, in the case of multiple available media devices. Given that this behaviour occasionally also happens with just one camera and one microphone, I'm not sure selecting the device programmatically would fix it.

karls commented 7 years ago

Actually, this does not seem to be a RecordRTC issue at all. I have not restarted by browser (Chrome) since I noticed this issue happening with our platform in order to investigate this issue. I can replicate the same behaviour on https://simpl.info/mediarecorder/ without using my external monitor, meaning that only 1 webcam and 1 mic is available for use. The result after recording looks like this -- no recorded blobs. Everything looks fine, I can see the stream in <video>, but after recording a clip, nothing shows up.

No recorded blobs

tdub7229 commented 7 years ago

Also experiencing this problem on Chrome 56.0.2924.87. When this happens on my laptop (which only has one microphone and one camera), the recording light on my laptop stays on.

Here is the chrome console output when it fails:

commits.js:2 You can use ?simple=true to remove redundant HTML.
commits.js:4watchers 782
commits.js:4 forks 345
commits.js:4 followers 1188
gumadapter.js:31 spec:   {"video":{},"audio":true}
gumadapter.js:31 chrome: {"video":{},"audio":true}
RecordRTC.js:54 started recording video stream.
RecordRTC.js:789 Using recorderType: MediaStreamRecorder
RecordRTC.js:1693 Passing following config over MediaRecorder API.
Object {type: "video", mimeType: "video/webm;codecs=h264", disableLogs: false, getNativeBlob: false, video: video}
RecordRTC.js:90 Initialized recorderType: MediaStreamRecorder for output-type: video
RecordRTC.js:103 Stopped recording video stream.
stopRecording @ RecordRTC.js:103

When it does work as expected, it's the same as above, but this line is also output:

RecordRTC.js:140 video/webm;codecs=h264 -> 22.5 KB
karls commented 7 years ago

Just to give an update to this -- some of our customers are having a fairly bad experience on Windows when another process has opened the webcam stream. Note that this does not seem to be the same issue as discussed here, but they might be related. I'm leaving this here for posterity.

I have also opened an issue on the Chromium bug tracker, https://bugs.chromium.org/p/chromium/issues/detail?id=690457, which also links to an issue on the Firefox bug tracker.

An operational update on my side is that we've stopped using RecordRTC for now and relying on just adapter.js. Adapter.js does not support Edge (no MediaRecorder), but we can live with it.

cdanzig commented 7 years ago

Just closed? No update?

muaz-khan commented 7 years ago

I think it is fixed here: https://github.com/muaz-khan/RecordRTC/commit/41c93ba01504bce84e406244ec3a3e2c5815340b

ykmo-VIRNECT commented 4 years ago

Well.. I'm facing same problem

jaketrimble commented 4 years ago

Also experiencing this issue with version 5.6.1 in Chrome 83.0.4103.61 (Official Build) (64-bit). Sometimes it fires the callback, but mostly it does not. Lots of debugging and no clues.

UPDATE: My logic was calling .stop() on tracks before calling .stopRecording(). Putting .stopRecording() before stopping tracks has solved the problem for me.