Make screen recorder with html css javascript | screen recorder javascript

Make screen recorder with html css javascript | screen recorder  javascript

 Welcome🎉 to Code With Random blog. In this blog, we learn that how we create a screen recorder app. We use HTML & javascript for this screen recorder. Hope you enjoy our blog so let’s start with a basic HTML structure for a screen recorder.

HTML code 

 <!DOCTYPE html>  
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
<video class="video" width="600px" controls></video>
<button class="record-btn">record</button>
<script src="./index.js"></script>

There is all HTML code for the screen recorder app. Now, you can see output without CSS, then we write javascript for the screen recorder.


Now add javascript for functionality.

Javascript code 

 let btn = document.querySelector(".record-btn")  
btn.addEventListener("click", async function () {
let stream = await navigator.mediaDevices.getDisplayMedia({
video: true
//needed for better browser support
const mime = MediaRecorder.isTypeSupported("video/webm; codecs=vp9")
? "video/webm; codecs=vp9"
: "video/webm"
let mediaRecorder = new MediaRecorder(stream, {
mimeType: mime
let chunks = []
mediaRecorder.addEventListener('dataavailable', function(e) {
mediaRecorder.addEventListener('stop', function(){
let blob = new Blob(chunks, {
type: chunks[0].type
let url = URL.createObjectURL(blob)
let video = document.querySelector("video")
video.src = url
let a = document.createElement('a')
a.href = url = 'video.webm'
//we have to start the recorder manually

Final output

Now we have completed our javascript section,  Here is our updated output with javascriptHope you like the screen recorder. you can see output video and project screenshots. See our other blogs and gain knowledge in front-end development. Thank you 🙏💕

credit – yt channel AngleBrace

In this post, we learn how to create an screen recorder  using simple HTML & CSS and javascript. If we made a mistake or any confusion, please drop a comment to reply or help you in easy learning.

Written by – Code With Random/Anki 

Share on:

0 thoughts on “Make screen recorder with html css javascript | screen recorder javascript”

Leave a Comment