loading...

Discussion on: Screen Recording in 10 lines of Vanilla JS

Collapse
jottedd profile image
Dr. Jeran Ott

Sebastian, Is there a way to also record the audio from the microphone?

Collapse
sebastianstamm profile image
Sebastian Stamm Author

Sure! Instead of calling getDisplayMedia you would need to call getUserMedia, like this:

const stream = await navigator.mediaDevices.getUserMedia({
  audio: true
});

You can then plug this stream into the MediaRecorder like described in the post.