Fix live mode (#310)

* add failing test

* paused -> live now possible
This commit is contained in:
Justin Halsall
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 6fad7f642c
commit 6ebfe69363
2 changed files with 16 additions and 0 deletions

View File

@@ -114,6 +114,10 @@ export function createPlayerService(
target: 'paused',
actions: 'castEvent',
},
TO_LIVE: {
target: 'live',
actions: ['startLive']
}
},
},
live: {

View File

@@ -131,4 +131,16 @@ describe('replayer', function (this: ISuite) {
expect(currentTime).to.equal(2500);
expect(currentState).to.equal('paused');
});
it('can stream events in live mode', async () => {
const status = await this.page.evaluate(`
const { Replayer } = rrweb;
const replayer = new Replayer(events, {
liveMode: true
});
replayer.startLive();
replayer.service.state.value;
`);
expect(status).to.equal('live');
})
});