fix auto play

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 91e91fe5e8
commit 7e3e13ffbf
3 changed files with 6 additions and 15 deletions

View File

@@ -16,7 +16,7 @@
"svelte": "^2.13.5" "svelte": "^2.13.5"
}, },
"dependencies": { "dependencies": {
"rrweb": "file:../rrweb" "rrweb": "^0.6.5"
}, },
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c",

View File

@@ -111,6 +111,7 @@
if (currentTime > 0) { if (currentTime > 0) {
replayer.resume(currentTime); replayer.resume(currentTime);
} else { } else {
this.set({ isPlaying: true });
replayer.play(currentTime); replayer.play(currentTime);
} }
}, },
@@ -135,8 +136,10 @@
onupdate({ changed, current, previous }) { onupdate({ changed, current, previous }) {
if (current.replayer && !previous) { if (current.replayer && !previous) {
// auto play // auto play
this.set({ isPlaying: true }); setTimeout(() => {
this.play(); this.set({ isPlaying: true });
}, 0);
current.replayer.play(0);
current.replayer.on('pause', () => { current.replayer.on('pause', () => {
this.set({ isPlaying: false }); this.set({ isPlaying: false });
}); });

View File

@@ -64,20 +64,8 @@
position: relative; position: relative;
background: white; background: white;
float: left; float: left;
clear: both;
border-radius: 5px; border-radius: 5px;
}
.rr-player::before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
box-shadow: 0 24px 48px rgba(17, 16, 62, 0.12); box-shadow: 0 24px 48px rgba(17, 16, 62, 0.12);
mix-blend-mode: multiply;
z-index: -1;
} }
.rr-player__frame { .rr-player__frame {