-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparler.html
52 lines (47 loc) · 1.35 KB
/
parler.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Parler</title>
<link rel="stylesheet" href="static/style.css">
<link rel="stylesheet" href="static/records.css">
</head>
<body>
<section>
<h2>C'est quoi un commun ?</h2>
<button onclick="start()" id="start">S'enregistrer</button>
<button onclick="stop()" id="stop" style="display: none">Terminer</button>
</section>
<section>
<div id="devices-list"></div>
</section>
</body>
</html>
<script src="/socket.io/socket.io.js"></script>
<script>
const socket = io();
var startButton = document.getElementById('start'),
stopButton = document.getElementById('stop');
function start () {
startButton.style.display = "none";
stopButton.style.display = "block";
socket.emit('start')
}
function stop () {
startButton.style.display = "block";
stopButton.style.display = "none";
socket.emit('stop');
}
socket.on('devicesList', (devices) => {
const list = document.querySelector('#devices-list');
devices.forEach((device, i) => {
let button = document.createElement('button');
button.innerText = device;
button.addEventListener('click', () => {
socket.emit('selectDevice', i)
});
list.appendChild(button);
})
});
</script>