<!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;
}
.container {
text-align: center;
margin-top: 20px;
}
.button {
display: inline-block;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
background-color: #4CAF50;
color: white;
border-radius: 5px;
border: none;
margin-right: 10px;
}
.button:hover {
background-color: #45a049;
}
#video-preview {
width: 640px;
height: 480px;
margin-top: 20px;
border: 2px solid #ccc;
}
</style>
</head>
<body>
<div class="container">
<h1>Screen Recorder Tool</h1>
<button id="start-button" class="button">Start Recording</button>
<button id="stop-button" class="button">Stop Recording</button>
</div>
<video id="video-preview" controls></video>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="https://cdn.WebRTC-Experiment.com/RecordRTC.js"></script>
<script>
var videoPreview = document.getElementById('video-preview');
var startButton = document.getElementById('start-button');
var stopButton = document.getElementById('stop-button');
var recorder; // RecordRTC object
startButton.addEventListener('click', startRecording);
stopButton.addEventListener('click', stopRecording);
function startRecording() {
navigator.mediaDevices.getDisplayMedia({ video: true, audio: true })
.then(function (stream) {
videoPreview.srcObject = stream;
videoPreview.play();
recorder = RecordRTC(stream, {
type: 'video'
});
recorder.startRecording();
})
.catch(function (error) {
console.error('Error accessing media devices.', error);
});
}
function stopRecording() {
recorder.stopRecording(function () {
var blob = recorder.getBlob();
videoPreview.srcObject = null;
videoPreview.src = URL.createObjectURL(blob);
videoPreview.muted = false;
videoPreview.controls = true;
});
}
</script>
</body>
</html>
Documentation
Step 1:- Open txt file from the folder for code
Step 2:- Copy all code
Step 3:- Open your website dashboard or blog
Step 4:- Add HTML element
Step 5:- Paste all code in your html element
Step 6:- Save file
Done you are successfully Pasted code in your website.