-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·75 lines (68 loc) · 1.91 KB
/
index.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
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/rrweb@latest/dist/rrweb.min.css" />
<!--<script src="https://cdn.jsdelivr.net/npm/rrweb@latest/dist/rrweb.min.js"></script>-->
<script src="js/rrweb/dist/rrweb.js"></script>
<!-- UI ONLY -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css"/>
<!--<script src="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/index.js"></script>-->
<script src="js/rrweb-player/dist/index.js"></script>
<!--audio recorder -->
<script src="js/recorder/app.js"></script>
<script src="js/recorder/WebAudioRecorder.min.js"></script>
<script>
let events = [];
let isActive;
let interval;
function start_rec()
{
isActive = rrweb.record({
emit(event) {
// push event into the events array
events.push(event);
},
});
// save events every 10 seconds
interval = setInterval(save, 1000);
}
// this function will send events to the backend and reset the events array
function save() {
console.log(events);
}
function stopRecord()
{
if (isActive)
isActive();
clearInterval(interval);
}
function replay(){
const replayer = new rrweb.Replayer(events, {root: document.body, modifiable:true});
replayer.play();
}
function ui(){
new rrwebPlayer({
target: document.body,
data: {
events,
autoPlay: true,
},
});
}
</script>
</head>
<body>
Hey, how are you ?
<br><br>
<textarea id="story" name="story"> </textarea>
<br><br>
<textarea id="secondStory"> </textarea>
<br><br><br>
<form>
<button type="button" id="recordButton" onclick="start_rec()">StartRec</button>
<button type="button" id="stopButton" onclick="stopRecord()">StopRec</button>
<button type="button" onclick="replay()">Replay</button>
<br>
<button type="button" onclick="ui()">UI</button>
</form>
</body>
</html>