<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Screen Recorder Tool</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
#controls {
text-align: center;
margin-bottom: 20px;
}
#video-container {
width: 100%;
max-width: 800px;
border: 2px solid #333;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
}
</style>
</head>
<body>
<div id="controls">
<button id="startButton">Start Recording</button>
<button id="stopButton" disabled>Stop Recording</button>
</div>
<div id="video-container">
<video id="videoElement" controls></video>
</div>
<script src="https://cdn.WebRTC-Experiment.com/RecordRTC.js"></script>
<script>
const startButton = document.getElementById('startButton');
const stopButton = document.getElementById('stopButton');
const videoElement = document.getElementById('videoElement');
let recorder;
startButton.addEventListener('click', async () => {
startButton.disabled = true;
stopButton.disabled = false;
const stream = await navigator.mediaDevices.getDisplayMedia({
video: true,
audio: true
});
videoElement.srcObject = stream;
recorder = RecordRTC(stream, {
type: 'video'
});
recorder.startRecording();
});
stopButton.addEventListener('click', () => {
startButton.disabled = false;
stopButton.disabled = true;
recorder.stopRecording(() => {
const blob = recorder.getBlob();
videoElement.src = URL.createObjectURL(blob);
const downloadLink = document.createElement('a');
downloadLink.href = URL.createObjectURL(blob);
downloadLink.download = 'recording.webm';
downloadLink.innerHTML = 'Download Recording';
document.body.appendChild(downloadLink);
});
});
</script>
</body>
</html>
कोई टिप्पणी नहीं:
एक टिप्पणी भेजें