enable click to play and update rrweb
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
"svelte": "^2.16.0"
|
"svelte": "^2.16.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"rrweb": "^0.7.9"
|
"rrweb": "^0.7.11"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup -c",
|
"build": "rollup -c",
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
<div class="rr-controller">
|
<div class="rr-controller">
|
||||||
<div class="rr-timeline">
|
<div class="rr-timeline">
|
||||||
<span class="rr-timeline__time">{formatTime(currentTime)}</span>
|
<span class="rr-timeline__time">{formatTime(currentTime)}</span>
|
||||||
<div class="rr-progress" ref:progress>
|
<div
|
||||||
|
class="rr-progress"
|
||||||
|
class:disabled="isSkipping"
|
||||||
|
ref:progress on:click="handleProgressClick(event)"
|
||||||
|
>
|
||||||
<div class="rr-progress__step" ref:step style="width: {percentage}"></div>
|
<div class="rr-progress__step" ref:step style="width: {percentage}"></div>
|
||||||
<div
|
<div
|
||||||
class="rr-progress__handler"
|
class="rr-progress__handler"
|
||||||
@@ -155,6 +159,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleProgressClick(event) {
|
handleProgressClick(event) {
|
||||||
|
const { meta, replayer, isPlaying, isSkipping } = this.get();
|
||||||
|
if (isSkipping) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const progressRect = this.refs.progress.getBoundingClientRect();
|
const progressRect = this.refs.progress.getBoundingClientRect();
|
||||||
const x = event.clientX - progressRect.left;
|
const x = event.clientX - progressRect.left;
|
||||||
let percent = x / progressRect.width;
|
let percent = x / progressRect.width;
|
||||||
@@ -163,7 +171,6 @@
|
|||||||
} else if (percent > 1) {
|
} else if (percent > 1) {
|
||||||
percent = 1;
|
percent = 1;
|
||||||
}
|
}
|
||||||
const { meta, replayer, isPlaying } = this.get();
|
|
||||||
const timeOffset = meta.totalTime * percent;
|
const timeOffset = meta.totalTime * percent;
|
||||||
this.set({ currentTime: timeOffset });
|
this.set({ currentTime: timeOffset });
|
||||||
replayer.play(timeOffset);
|
replayer.play(timeOffset);
|
||||||
@@ -254,7 +261,13 @@
|
|||||||
background: #eee;
|
background: #eee;
|
||||||
position: relative;
|
position: relative;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
/* cursor: pointer; */
|
cursor: pointer;
|
||||||
|
border-top: solid 4px #fff;
|
||||||
|
border-bottom: solid 4px #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rr-progress.disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rr-progress__step {
|
.rr-progress__step {
|
||||||
|
|||||||
@@ -64,6 +64,9 @@
|
|||||||
const { replayer } = this.get();
|
const { replayer } = this.get();
|
||||||
replayer.on(event, handler);
|
replayer.on(event, handler);
|
||||||
},
|
},
|
||||||
|
addEvent(event) {
|
||||||
|
replayer.addEvent(event);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
oncreate() {
|
oncreate() {
|
||||||
const { events } = this.get();
|
const { events } = this.get();
|
||||||
|
|||||||
Reference in New Issue
Block a user