Skip to content

Commit

Permalink
Merge pull request #3 from amplitude/skip-inactive-periods
Browse files Browse the repository at this point in the history
feat: skip through inactive periods instead of fast forward
  • Loading branch information
jxiwang authored Oct 18, 2023
2 parents 7e43b85 + dbc22b9 commit 605a78d
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions packages/rrweb/src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,10 +679,6 @@ export class Replayer {
// do not check skip in sync
return;
}
if (event === this.nextUserInteractionEvent) {
this.nextUserInteractionEvent = null;
this.backToNormal();
}
if (this.config.skipInactive && !this.nextUserInteractionEvent) {
for (const _event of this.service.state.context.events) {
if (_event.timestamp <= event.timestamp) {
Expand All @@ -704,14 +700,8 @@ export class Replayer {
const skipTime =
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.nextUserInteractionEvent.delay! - event.delay!;
const payload = {
speed: Math.min(
Math.round(skipTime / SKIP_TIME_INTERVAL),
this.config.maxSpeed,
),
};
this.speedService.send({ type: 'FAST_FORWARD', payload });
this.emitter.emit(ReplayerEvents.SkipStart, payload);
this.play(this.getCurrentTime() + skipTime)
this.nextUserInteractionEvent = null;
}
}
};
Expand Down

0 comments on commit 605a78d

Please sign in to comment.