bugfix and update rrweb

This commit is contained in:
Yanzhen Yu
2018-12-27 18:18:29 +08:00
parent c00b38ba1a
commit 4f6ef05f13
3 changed files with 8 additions and 5 deletions

View File

@@ -16,7 +16,7 @@
"svelte": "^2.16.0" "svelte": "^2.16.0"
}, },
"dependencies": { "dependencies": {
"rrweb": "^0.7.0" "rrweb": "^0.7.2"
}, },
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c",

View File

@@ -136,11 +136,14 @@
} }
}, },
setSpeed(speed) { setSpeed(speed) {
const { replayer, currentTime } = this.get(); const { replayer, currentTime, isPlaying } = this.get();
// freeze before set speed, and resume if is playing before freeze
replayer.pause(); replayer.pause();
replayer.setConfig({ speed }); replayer.setConfig({ speed });
this.set({ speed }); this.set({ speed });
replayer.resume(currentTime); if (isPlaying) {
replayer.resume(currentTime);
}
}, },
handleProgressClick(event) { handleProgressClick(event) {
const progressRect = this.refs.progress.getBoundingClientRect(); const progressRect = this.refs.progress.getBoundingClientRect();
@@ -162,6 +165,7 @@
}, },
onupdate({ changed, current, previous }) { onupdate({ changed, current, previous }) {
if (current.replayer && !previous) { if (current.replayer && !previous) {
window.replayer = current.replayer;
// auto play // auto play
setTimeout(() => { setTimeout(() => {
this.set({ isPlaying: true }); this.set({ isPlaying: true });
@@ -192,7 +196,7 @@
} }
} }
if (changed.skipInactive) { if (changed.skipInactive) {
current.replayer.setConfig({ skipInactive: changed.skipInactive }); current.replayer.setConfig({ skipInactive: current.skipInactive });
} }
}, },
ondestroy() { ondestroy() {

View File

@@ -21,7 +21,6 @@
.label { .label {
margin: 0 8px; margin: 0 8px;
height: 1em;
} }
.switch input[type='checkbox'] { .switch input[type='checkbox'] {