Files
rrweb/docs/recipes/canvas.zh_CN.md
yz-yu 655f96da61 Update zh_CN Docs (#384)
* update zh_CN guide, with latest API and options

* add receipes

* update receipes and guide

* update #329 add links to README
2026-04-01 12:00:00 +08:00

525 B

Canvas

Canvas 是一种特殊的 HTML 元素,默认情况下其内容不会被 rrweb 观测。我们可以通过特定的配置让 rrweb 能够录制并回放 Canvas。

录制时包含 Canvas 内的内容:

rrweb.record({
  emit(event) {},
  // 对 canvas 进行录制
  recordCanvas: true,
});

回放时对 Canvas 进行回放:

const replayer = new rrweb.Replayer(events, {
  UNSAFE_replayCanvas: true,
});
replayer.play();

回放 Canvas 将会关闭沙盒策略,导致一定风险