-
Notifications
You must be signed in to change notification settings - Fork 0
/
recorder.html
187 lines (175 loc) · 6.36 KB
/
recorder.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Charm&family=Courgette&family=Noto+Nastaliq+Urdu:wght@600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="./css/style.css">
<link rel="icon" href="./Imgs/favicon1.ico">
<title>Document</title>
<style>
#start {
margin-top: 15px;
font-family: 'Courgette', cursive;
position: absolute;
left: 20%;
align-items: center;
background-image: radial-gradient(100% 100% at 100% 0, #23ffd3 0, #00bd72 100%);
border: 0;
border-radius: 10px;
box-shadow: rgba(45, 35, 66, .4) 0 2px 4px,rgba(45, 35, 66, .3) 0 7px 13px -3px,rgba(58, 65, 111, .5) 0 -3px 0 inset;
box-sizing: border-box;
color: rgb(6, 64, 0);
cursor: pointer;
display: inline-flex;
height: 48px;
justify-content: center;
line-height: 1;
list-style: none;
overflow: hidden;
padding-left: 20px;
padding-right: 20px;
text-align: center;
text-decoration: none;
transition: box-shadow .15s,transform .15s;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
white-space: nowrap;
will-change: box-shadow,transform;
font-size: 18px;
}
#start:focus {
box-shadow: #00094e 0 0 0 1.5px inset, rgba(45, 35, 66, .4) 0 2px 4px, rgba(45, 35, 66, .3) 0 7px 13px -3px, #000c65 0 -3px 0 inset;
}
#start:hover {
box-shadow: rgba(45, 35, 66, .4) 0 4px 8px, rgba(45, 35, 66, .3) 0 7px 13px -3px, #00094a 0 -3px 0 inset;
transform: translateY(-2px);
}
#start:active {
box-shadow: #004709 0 3px 7px inset;
transform: translateY(2px);
}
#stop {
margin-top: 15px;
position: absolute;
right: 20%;
align-items: center;
background-image: radial-gradient(100% 100% at 100% 0, #ff4343 0, #cf0000 100%);
border: 0;
border-radius: 10px;
box-shadow: rgba(45, 35, 66, .4) 0 2px 4px,rgba(45, 35, 66, .3) 0 7px 13px -3px,rgba(58, 65, 111, .5) 0 -3px 0 inset;
box-sizing: border-box;
color: rgb(57, 0, 0);
cursor: pointer;
display: inline-flex;
font-family: 'Courgette', cursive;
height: 48px;
justify-content: center;
line-height: 1;
list-style: none;
overflow: hidden;
padding-left: 20px;
padding-right: 20px;
text-align: center;
text-decoration: none;
transition: box-shadow .15s,transform .15s;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
white-space: nowrap;
will-change: box-shadow,transform;
font-size: 18px;
}
#stop:focus {
box-shadow: #010948 0 0 0 1.5px inset, rgba(45, 35, 66, .4) 0 2px 4px, rgba(45, 35, 66, .3) 0 7px 13px -3px, #00094b 0 -3px 0 inset;
}
#stop:hover {
box-shadow: rgba(45, 35, 66, .4) 0 4px 8px, rgba(45, 35, 66, .3) 0 7px 13px -3px, #6f0000 0 -3px 0 inset;
transform: translateY(-2px);
}
#stop:active {
box-shadow: #5f0000 0 3px 7px inset;
transform: translateY(2px);
}
video {
margin-top: 30px;
position: relative;
border: 1px solid lightgray;
left: 20%;
width: 60%;
background-color: #eee;
border-radius: 15px;
}
@media screen and (max-width: 1150px) and (min-width: 100px) {
video{
left: 5%;
width: 90%;
}
#start{
left: 5%;
padding-left: 15px;
padding-right: 15px;
}
#stop{
padding-left: 15px;
padding-right: 15px;
right: 5%;
}
}
</style>
</head>
<body>
<nav class="bg_nav">
<div class="navbs">
<button class="lefb">
<a href="index.html" class="anchor_tg">Home</a>
</button>
<button class="righb">
<a href="streaming_idx.html" class="anchor_tg">Stream</a>
</button>
</div>
</nav>
<main>
<video src="./Imgs/instructions.mp4" autoplay controls></video>
<br>
<button id="start">
Start Recording
</button>
<button id="stop" disabled>
Stop Recording
</button>
</main>
<script>
const start = document.getElementById("start");
const stop = document.getElementById("stop");
const video = document.querySelector("video");
let recorder, stream;
async function startRecording() {
stream = await navigator.mediaDevices.getDisplayMedia({
video: { mediaSource: "screen" }
});
recorder = new MediaRecorder(stream);
const chunks = [];
recorder.ondataavailable = e => chunks.push(e.data);
recorder.onstop = e => {
const completeBlob = new Blob(chunks, { type: chunks[0].type });
video.src = URL.createObjectURL(completeBlob);
};
recorder.start();
}
start.addEventListener("click", () => {
start.setAttribute("disabled", true);
stop.removeAttribute("disabled");
startRecording();
});
stop.addEventListener("click", () => {
stop.setAttribute("disabled", true);
start.removeAttribute("disabled");
recorder.stop();
stream.getVideoTracks()[0].stop();
});
</script>
</body>
</html>