update rrweb and use the resume method with better performance

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 0e4f6649e4
commit ffdddbac02
3 changed files with 23 additions and 7 deletions

View File

@@ -15,12 +15,24 @@
<script src="./bundle.js"></script> <script src="./bundle.js"></script>
<script src="./bundle.events.js"></script> <script src="./bundle.events.js"></script>
<script> <script>
const player = new rrwebPlayer({ const queryObj = {
target: document.body, sessionId: 'e2c7cfe8-d868-4f11-b561-5a969da26334',
data: { };
events, let query = '';
}, Object.keys(queryObj).forEach(key => {
query += `${key}=${queryObj[key]}&`;
}); });
fetch(`http://192.168.17.205:9090/api/events?${query}`)
.then(res => res.json())
.then(data => {
// eslint-disable-next-line
new rrwebPlayer({
target: document.body,
data: {
events: data.events,
},
});
});
</script> </script>
</body> </body>

View File

@@ -72,7 +72,11 @@
}, },
play() { play() {
const { replayer, currentTime } = this.get(); const { replayer, currentTime } = this.get();
replayer.play(currentTime); if (currentTime > 0) {
replayer.resume(currentTime);
} else {
replayer.play(currentTime);
}
this.loopTimer(); this.loopTimer();
}, },
pause() { pause() {

View File

@@ -29,5 +29,5 @@ export function formatTime(ms) {
if (hour) { if (hour) {
return `${padZero(hour)}:${padZero(minute)}:${padZero(minute)}`; return `${padZero(hour)}:${padZero(minute)}:${padZero(minute)}`;
} }
return `${padZero(hour)}:${padZero(second)}`; return `${padZero(minute)}:${padZero(second)}`;
} }