screen recorder Tool
- Get link
- X
- Other Apps
<!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: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
#recorder-container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
text-align: center;
}
button {
padding: 10px 20px;
margin-top: 20px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
#preview {
margin-top: 20px;
width: 100%;
border: 1px solid #ccc;
border-radius: 5px;
}
#controls {
margin-top: 20px;
display: flex;
justify-content: center;
align-items: center;
}
#controls button {
margin: 0 10px;
}
#download-link {
display: block;
margin-top: 20px;
text-align: center;
color: #007bff;
text-decoration: none;
}
</style>
</head>
<body>
<div id="recorder-container">
<h1>Screen Recorder</h1>
<button id="start-recording">Start Recording</button>
<button id="stop-recording" disabled>Stop Recording</button>
<div id="preview"></div>
<div id="controls">
<button id="download-video" disabled>Download Video</button>
<button id="download-audio" disabled>Download Audio</button>
</div>
<a href="#" id="download-link" download></a>
</div>
<script src="https://cdn.WebRTC-Experiment.com/RecordRTC.js"></script>
<script>
let recorder;
let stream;
const startRecording = async () => {
try {
stream = await navigator.mediaDevices.getDisplayMedia({ video: true, audio: true });
recorder = new RecordRTC(stream, {
type: 'video',
mimeType: 'video/webm',
bitsPerSecond: 128000
});
recorder.startRecording();
document.getElementById('start-recording').disabled = true;
document.getElementById('stop-recording').disabled = false;
} catch (error) {
console.error('Error starting recording:', error);
}
};
const stopRecording = () => {
recorder.stopRecording(() => {
stream.getTracks().forEach(track => track.stop());
document.getElementById('start-recording').disabled = false;
document.getElementById('stop-recording').disabled = true;
document.getElementById('download-video').disabled = false;
document.getElementById('download-audio').disabled = false;
const blob = recorder.getBlob();
const url = URL.createObjectURL(blob);
document.getElementById('preview').innerHTML = `<video controls src="${url}" width="320"></video>`;
document.getElementById('download-video').onclick = () => {
invokeSaveAsDialog(blob, 'video.webm');
};
document.getElementById('download-audio').onclick = () => {
const audioBlob = new Blob([recorder.getAudioBlob()], { type: 'audio/wav' });
invokeSaveAsDialog(audioBlob, 'audio.wav');
};
document.getElementById('download-link').href = url;
document.getElementById('download-link').innerText = 'Download Video';
});
};
document.getElementById('start-recording').addEventListener('click', startRecording);
document.getElementById('stop-recording').addEventListener('click', stopRecording);
</script>
</body>
</html>
- Get link
- X
- Other Apps
Comments
Post a Comment