Home / Media and Real Time / Screen Recorder

Screen Recorder in JavaScript, Free with Live Demo

Free screen recorder in plain JavaScript. Record a screen, window or tab with your microphone and a webcam bubble, then preview and download the video.

Open live demoDownload HTML fileView code on GitHub
Screen Recorder JavaScript project: record your screen with your voice and your face in the corner

Runs on: Screen Capture, MediaRecorder. Chrome, Edge and Firefox on desktop. Safari records screens but not tab audio. Phones cannot share their screen from a web page.

What is the Screen Recorder?

Record your whole screen, one window or one tab, talk over it and add your face in a round bubble in the corner. When you stop, watch it back and save the file. Nothing is uploaded.

getDisplayMedia opens the browser's own picker for what to share. The screen and webcam are drawn onto one canvas, the microphone and screen audio are mixed with Web Audio, and MediaRecorder turns it all into a video file.

Good for

  • Tutorials and bug reports
  • Product demos
  • Recording lessons
  • Learning browser media APIs

What this project does

How it works

  1. Pick what to shareThe browser shows its own picker for screens, windows and tabs. The page never sees anything you did not pick.
  2. Mix the sourcesScreen video and webcam are drawn onto one canvas. Microphone and screen audio are mixed with an AudioContext.
  3. RecordMediaRecorder turns the combined stream into video chunks. On stop they become one file you can play or save.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

const screen = await navigator.mediaDevices.getDisplayMedia({ video: true, audio: true });
const mic = await navigator.mediaDevices.getUserMedia({ audio: true });

// Mix screen audio and microphone into one track
const ctx = new AudioContext(), out = ctx.createMediaStreamDestination();
[screen, mic].forEach((s) => s.getAudioTracks().length && ctx.createMediaStreamSource(s).connect(out));

const stream = new MediaStream([...screen.getVideoTracks(), ...out.stream.getAudioTracks()]);
const rec = new MediaRecorder(stream, { mimeType: "video/webm;codecs=vp9,opus" });
rec.ondataavailable = (e) => chunks.push(e.data);
rec.onstop = () => download(new Blob(chunks, { type: rec.mimeType }));
rec.start(1000);

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

What format are the recordings?

WebM in most browsers, and MP4 where the browser supports recording it. Both play in modern browsers and editors.

Can it record system sound?

Tab audio works in Chrome and Edge when you share a tab. Full system audio depends on the operating system.

Does it work on phones?

No. Mobile browsers do not let web pages share the screen yet.

More Media and Real Time projects