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

"Stop Sharing" button on Windows corrupts webm file #653

Closed erbzz closed 3 years ago

erbzz commented 4 years ago

Hi,

I think I have come across an issue with RecordRTC. I am developing a way to record the screen on chrome in javascript, starting and stopping it based on some DOM events and then upload the recording to aws s3 on completion. I've tested the functionality on Windows and on Mac and when the recordings are started and stopped via the DOM events, everything works as expected and the recordings are good. However, when I use the Stop sharing button to stop the recording on windows, the webm file gets corrupted and is unplayable. I am not sure if the issue comes from the handling of the stop sharing event, the aws s3 multipart upload, or the way I handle blobs. On Mac, there doesn't seem to be an issue. Here is the relevant code:

I have the oninactive handler for detecting this event as follows: (stream.oninactive = () => endRecording());

In the endRecording function, I stop the recorder like so: recorder.stopRecording((blobUrl) => { }); and then upload to s3.

EDIT: The issue turned out to be from the onDataAvailable function from a minimum blob size requirement. This is resolved for me.

erbzz commented 3 years ago

Fixed this by using the following version: "recordrtc": "https://github.com/stijnvanderpol/RecordRTC#bafda82"

See: https://github.com/muaz-khan/RecordRTC/commit/0f787fedd5dab73a59f41720e28dc8219f3caa70 for reference