DEV Community

Discussion on: Lets create a screen recorder with JS

landb profile image
Branko Stancevic • Edited on

Great article! Keep it up! However, I have question...

Why you need to create chunks when in dataavailable is already a blob?

Isn't that part kinda unnecessary?

Couldn't we just use it like this?

  let blob = null;

  mediaRecorder.addEventListener('dataavailable', (e) => {
    blob =;
Enter fullscreen mode Exit fullscreen mode
0shuvo0 profile image
Shuvo Author

as you keep recording the dataavailable event will run multiple time. So basically instead you giving you the entire video once recording is done it will give you data in small parts as the video is being recorded.

landb profile image
Branko Stancevic

Ok cool! Thank you