diff --git a/package.json b/package.json index a96ac663..5049bcec 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "svelte": "^2.16.0" }, "dependencies": { - "rrweb": "^0.7.2" + "rrweb": "^0.7.7" }, "scripts": { "build": "rollup -c", diff --git a/public/index.html b/public/index.html index 857cd297..8dafb1ed 100644 --- a/public/index.html +++ b/public/index.html @@ -19,6 +19,7 @@ target: document.body, data: { events, + autoPlay: false, }, }); diff --git a/src/Controller.html b/src/Controller.html index f9878b15..f95ce5c2 100644 --- a/src/Controller.html +++ b/src/Controller.html @@ -175,11 +175,19 @@ onupdate({ changed, current, previous }) { if (current.replayer && !previous) { window.replayer = current.replayer; - // auto play setTimeout(() => { this.set({ isPlaying: true }); }, 0); current.replayer.play(0); + if (!current.autoPlay) { + let firstFullSnapshotRebuilded = false; + current.replayer.on('fullsnapshot-rebuilded', () => { + if (!firstFullSnapshotRebuilded) { + firstFullSnapshotRebuilded = true; + current.replayer.pause(); + } + }); + } current.replayer.on('pause', () => { this.set({ isPlaying: false }); }); diff --git a/src/Player.html b/src/Player.html index d4524723..09d4958f 100644 --- a/src/Player.html +++ b/src/Player.html @@ -1,7 +1,7 @@