packages/rrweb-player/README.md
Looking for a Vue.js version? Go here --> @preflight-hq/rrweb-player-vue
Since rrweb's replayer only provides a basic UI, you can choose rrweb-replayer which is based on rrweb's public APIs but has a feature-rich replayer UI.
rrweb.Replayer?rrweb-player uses rrweb's Replayer under the hood, but as Replayer doesn't include any UI for controls, rrweb-player adds those.
npm install rrweb-player
import rrwebPlayer from 'rrweb-player';
import 'rrweb-player/dist/style.css';
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css"
/>
<script type="importmap">
{
"imports": {
"rrweb-player": "https://cdn.jsdelivr.net/npm/rrweb-player@latest/+esm"
}
}
</script>
<script type="module">
import rrwebPlayer from 'rrweb-player';
</script>
<script> Include (UMD fallback)Use this only for compatibility with non-module environments.
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css"
/>
<script src="https://cdn.jsdelivr.net/npm/rrweb-player@latest/umd/rrweb-player.min.js"></script>
new rrwebPlayer({
target: document.body, // customizable root element
props: {
events,
},
});
| key | default | description |
|---|---|---|
| events | [] | the events for replaying |
| width | 1024 | the width of the replayer |
| height | 576 | the height of the replayer |
| maxScale | 1 | the maximum scale of the replayer (1 = 100%), set to 0 for unlimited |
| autoPlay | true | whether to autoplay |
| speed | 1 | The default speed to play at |
| speedOption | [1, 2, 4, 8] | speed options in UI |
| showController | true | whether to show the controller UI |
| tags | {} | customize the custom events style with a key-value map |
| inactiveColor | #D4D4D4 | Customize the color of inactive periods indicator in the progress bar with a valid CSS color string. |
| ... | - | all the rrweb Replayer options will be bypassed |
addEventListener(event: string, handler: (params: any) => unknown): void;
addEvent(event: eventWithTime): void;
getMetaData() => {
startTime: number;
endTime: number;
totalTime: number;
}
getReplayer() => Replayer;
getMirror() => Mirror;
Toggles between play/pause
toggle();
Sets speed of player
setSpeed(speed: number)
Turns on/off skip inactive
toggleSkipInactive();
Triggers resize, do this whenever you change width/height
triggerResize();
Plays replay
play();
Pauses replay
pause();
Go to a point in time and pause or play from then
goto(timeOffset: number, play?: boolean)
Plays from a time to a time and (optionally) loop
playRange(
timeOffset: number,
endTimeOffset: number,
startLooping: boolean = false,
afterHook: undefined | (() => void) = undefined,
)
Become a sponsor and get your logo on our README on Github with a link to your site.
<a href="https://opencollective.com/rrweb/tiers/gold-sponsor/0/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/gold-sponsor/1/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/gold-sponsor/2/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/gold-sponsor/3/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/gold-sponsor/4/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/gold-sponsor/5/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/gold-sponsor/6/website?requireActive=false" target="_blank"></a>
</div><a href="https://opencollective.com/rrweb/tiers/silver-sponsor/0/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/silver-sponsor/1/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/silver-sponsor/2/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/silver-sponsor/3/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/silver-sponsor/4/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/silver-sponsor/5/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/silver-sponsor/6/website?requireActive=false" target="_blank"></a>
</div><a href="https://opencollective.com/rrweb/tiers/sponsors/0/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/1/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/2/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/3/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/4/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/5/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/6/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/7/website?requireActive=false" target="_blank"></a> <a href="https://opencollective.com/rrweb/tiers/sponsors/8/website?requireActive=false" target="_blank"></a>
</div><a href="https://opencollective.com/rrweb#sponsor" rel="nofollow"></a>
<sub><b>Yuyz0112</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/YunFeng0817">
<sub><b>Yun Feng</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/eoghanmurray">
<sub><b>eoghanmurray</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/Juice10">
<sub><b>Juice10</b></sub>
<sub>open for rrweb consulting</sub> </a> </td>
</tr> </table> </a>
</td>
<td align="center">
<a href="https://posthog.com?utm_source=rrweb&utm_medium=sponsorship&utm_campaign=open-source-sponsorship" target="_blank">
</a>
</td>
<td align="center">
<a href="https://statcounter.com/session-replay/" target="_blank">
</a>
</td>
<td align="center">
<a href="https://recordonce.com/" target="_blank">
</a>
</td>
</a>
</td>
<td align="center">
<a href="https://remsupp.com" target="_blank">
</a>
</td>
<td align="center">
<a href="https://highlight.io" target="_blank">
</a>
</td>
<td align="center">
<a href="https://analyzee.io" target="_blank">
</a>
</td>
</a>
</td>
<td align="center">
<a href="https://gleap.io" target="_blank">
</a>
</td>
<td align="center">
<a href="https://uxwizz.com" target="_blank">
</a>
</td>
<td align="center">
<a href="https://www.howdygo.com" target="_blank">
</a>
</td>