@amplitude/rrweb-player

中文文档
2.1.6发布于 2026/11/05MITTypeScriptESM + CJS构建来源已验证近 30 天下载 1.5万

rrweb's replayer UI

原始使用文档
文档目录5 节
  1. How is this different from rrweb.Replayer ?
  2. Installation
  3. Usage
  4. Options
  5. methods on the rrwebPlayer component

Looking for a Vue.js version? Go here --> @preflight-hq/rrweb-player-vue


rrweb-player

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.

How is this different from 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.

Installation

rrweb-player can also be included with <script>:

<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/dist/index.umd.cjs"></script>

Or installed by using NPM:

npm install --save rrweb-player
import rrwebPlayer from 'rrweb-player';
import 'rrweb-player/dist/style.css';

Usage

new rrwebPlayer({
  target: document.body, // customizable root element
  props: {
    events,
  },
});

Options

keydefaultdescription
events[]the events for replaying
width1024the width of the replayer
height576the height of the replayer
maxScale1the maximum scale of the replayer (1 = 100%), set to 0 for unlimited
autoPlaytruewhether to autoplay
speed1The default speed to play at
speedOption[1, 2, 4, 8]speed options in UI
showControllertruewhether to show the controller UI
tags{}customize the custom events style with a key-value map
inactiveColor#D4D4D4Customize the color of inactive periods indicator in the progress bar with a valid CSS color string.
...-all the rrweb Replayer options will be bypassed

methods on the rrwebPlayer component

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,
  )

版本与发布记录

@amplitude/rrweb-player 共发布 36 个版本,首次发布于 2023/10/24;过去 12 个月发布了 14 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.1.6latest2026/11/051 天前
2.1.52026/10/2314 天前
2.1.42026/09/251 个月前
2.1.32026/07/024 个月前
2.1.22026/07/014 个月前
2.1.12026/05/125 个月前

其他发布通道:alpha → 2.0.0-alpha.12。

关于 @amplitude/rrweb-player 的常见问题

@amplitude/rrweb-player 是什么?

rrweb's replayer UI

如何安装 @amplitude/rrweb-player?

在项目目录运行 npm install @amplitude/rrweb-player,或使用 pnpm add / yarn add / bun add。

@amplitude/rrweb-player 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@amplitude/rrweb-player 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@amplitude/rrweb-player 可以商用吗?

@amplitude/rrweb-player 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@amplitude/rrweb-player 的下载量有多少?

根据 npm 官方下载统计,@amplitude/rrweb-player 在 2026/10/06 – 2026/11/04 这 30 天内被下载 15,436 次,日均约 515 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@amplitude/rrweb-player 还在维护吗?

最新版本 2.1.6 发布于 2026/11/05(1 天前);至今共发布 36 个版本,其中过去 12 个月发布了 14 个;首次发布于 2023/10/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。