Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@juice10/rrweb-player

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@juice10/rrweb-player

rrweb's replayer UI

latest
Source
npmnpm
Version
0.5.9
Version published
Maintainers
1
Created
Source

rrwebPlayer

npm install --save @juice10/rrweb-player
import rrwebPlayer from '@juice10/rrweb-player';

const events = [...];
const player = new rrwebPlayer({
  target: document.getElementById('replay-window'),
  data: {
    events,
    autoPlay: false,
    skipMouseMove: true,
    showController: true, // show play/pause/scrubber and other controls
    width: 1080 / 4,
    height: 1920 / 4,
  },
});

// loop first 10 events
player.playFromToTime(
  events[0].timestamp,
  events[10].timestamp,
  true,
);

// move player to event timestamp
player.goToTime(action.events[10].timestamp);

How to use the callback on player.playFromToTime:

const eventsGroup = [{
  events: ...
}, ...];
const onPauseHook = function () {
  if (!eventsGroup[i]) return;
  const loop = false;
  const fromTimestamp = eventsGroup[i].events[0].timestamp;
  let toTimestamp;
  if(eventsGroup[i + 1]) {
    toTimestamp = eventsGroup[i + 1].events[0].timestamp;
  } else {
    toTimestamp = eventsGroup[i].events[eventsGroup[i].events.length - 1].timestamp;
  }
  player.playFromToTime(
    fromTimestamp,
    toTimestamp,
    loop, // loop
    onPauseHook,
  );
  i += 1;
};
onPauseHook();

modifying this project

This is a project is based on Svelte version 2. Documentation for Svelte v2

Get started

Install the dependencies...

cd rrweb-player
npm install

...then start Rollup:

npm run dev

Navigate to localhost:5000. You should see your app running. Edit a component file in src, save it, and reload the page to see your changes.

Deploying to the web

With now

Install now if you haven't already:

npm install -g now

Then, from within your project folder:

now

As an alternative, use the Now desktop client and simply drag the unzipped project folder to the taskbar icon.

With surge

Install surge if you haven't already:

npm install -g surge

Then, from within your project folder:

npm run build
surge public

Keywords

rrweb

FAQs

Package last updated on 07 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts