DEV Community

Discussion on: Lets create a screen recorder with JS

Collapse
landb profile image
Branko Stancevic • Edited on

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

Why you need to create chunks when e.data 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 = e.data;
  })
Enter fullscreen mode Exit fullscreen mode
Collapse
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.

Collapse
landb profile image
Branko Stancevic

Ok cool! Thank you