forked from datalad-datasets/ohbm2020-posters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
room.html
36 lines (33 loc) · 1.21 KB
/
room.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
<!doctype html>
<html>
<head>
<script src='https://meet.jit.si/external_api.js'></script>
<script type="text/javascript" charset="utf-8" src="assets/js/reconnecting-websocket.min.js"></script>
<link rel="stylesheet" type="text/css" href="assets/css/room.css">
</head>
<body>
<div id="meet"/>
<script>
let hash = location.hash.substring(1); //jitsi room name
let id = hash.split(".")[0];
let roomName = hash.split(".")[1];
let cid = Math.random().toString(); //client id
if(!roomName) alert("no room name set in hash");
console.log(roomName);
const api = new JitsiMeetExternalAPI("meet.jit.si", {
roomName,
parentNode: document.querySelector('#meet')
})
let wss = new ReconnectingWebSocket("wss://dev1.soichi.us/ohbm2020/");
wss.onopen = () => {
wss.send(JSON.stringify({action: "jit", id, cid}));
setInterval(()=>{
wss.send(JSON.stringify({action: "jit", id, cid}));
}, 1000*30);
}
window.addEventListener("beforeunload", function(evt) {
wss.send(JSON.stringify({action: "jitclose", id, cid}));
});
</script>
</body>
</html>