<!DOCTYPE html>
<html>
<head>
<title>Screen Recorder Tool</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
text-align: center;
}
#video-container {
width: 100%;
max-width: 800px;
margin: 0 auto;
}
#record-button {
background-color: #4CAF50;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<div id="video-container">
<video id="record-video" autoplay playsinline controls></video>
</div>
<button id="record-button">Start Recording</button>
<script src="https://cdn.webrtc-experiment.com/RecordRTC.js"></script>
<script>
let recorder;
document.getElementById("record-button").addEventListener("click", () => {
const videoElement = document.getElementById("record-video");
if (recorder && recorder.state === "recording") {
recorder.stopRecording(() => {
recorder.save("recorded-video");
recorder = null;
});
document.getElementById("record-button").textContent = "Start Recording";
} else {
navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then((stream) => {
recorder = RecordRTC(stream, { type: "video" });
recorder.startRecording();
videoElement.srcObject = stream;
document.getElementById("record-button").textContent = "Stop Recording";
});
}
});
</script>
</body>
</html>