Screen Recorder Tool
Screen Recorder Tool
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
text-align: center;
}
h1 {
color: #333;
}
button {
padding: 10px 20px;
margin: 10px;
border: none;
background-color: #007bff;
color: #fff;
border-radius: 5px;
cursor: pointer;
outline: none;
}
button:disabled {
background-color: #ccc;
cursor: not-allowed;
}
const startBtn = document.getElementById("startBtn");
const stopBtn = document.getElementById("stopBtn");
const recordedVideo = document.getElementById("recordedVideo");
let recorder;
startBtn.addEventListener("click", async () => {
startBtn.disabled = true;
stopBtn.disabled = false;
const stream = await navigator.mediaDevices.getDisplayMedia({
video: { mediaSource: "screen" },
audio: true
});
recorder = new RecordRTC(stream, {
type: "video",
mimeType: "video/webm",
});
recorder.startRecording();
});
stopBtn.addEventListener("click", () => {
startBtn.disabled = false;
stopBtn.disabled = true;
recorder.stopRecording(() => {
recordedVideo.src = URL.createObjectURL(recorder.getBlob());
});
});
br<