Skip to content

Commit e717cda

Browse files
authored
Fix live mode (#310)
* add failing test * paused -> live now possible
1 parent 772c0e0 commit e717cda

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/replay/machine.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ export function createPlayerService(
114114
target: 'paused',
115115
actions: 'castEvent',
116116
},
117+
TO_LIVE: {
118+
target: 'live',
119+
actions: ['startLive']
120+
}
117121
},
118122
},
119123
live: {

test/replayer.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,16 @@ describe('replayer', function (this: ISuite) {
131131
expect(currentTime).to.equal(2500);
132132
expect(currentState).to.equal('paused');
133133
});
134+
135+
it('can stream events in live mode', async () => {
136+
const status = await this.page.evaluate(`
137+
const { Replayer } = rrweb;
138+
const replayer = new Replayer(events, {
139+
liveMode: true
140+
});
141+
replayer.startLive();
142+
replayer.service.state.value;
143+
`);
144+
expect(status).to.equal('live');
145+
})
134146
});

0 commit comments

Comments
 (0)