diff --git a/.changeset/brave-browsers-remember.md b/.changeset/brave-browsers-remember.md
new file mode 100644
index 0000000000..666aceddfe
--- /dev/null
+++ b/.changeset/brave-browsers-remember.md
@@ -0,0 +1,8 @@
+---
+"@rrweb/browser-client": patch
+"rrweb": patch
+"rrweb-snapshot": patch
+"@rrweb/types": patch
+---
+
+Add asset capture support across rrweb recording, snapshotting, replay, and shared types, and prepare `@rrweb/browser-client` for release with capture asset defaults, diagnostics coverage, and commit-aware build metadata.
diff --git a/docs/recipes/assets.md b/docs/recipes/assets.md
new file mode 100644
index 0000000000..4c6ed911db
--- /dev/null
+++ b/docs/recipes/assets.md
@@ -0,0 +1,53 @@
+# Asset Capture
+
+Asset capture records external resources as `Asset` events that are associated with the snapshot or mutation where rrweb found the resource. During replay, rrweb applies those assets when rebuilding the matching snapshot, so images, media, and stylesheets can be replayed even when the original URL is unavailable or has changed.
+
+Use `captureAssets` with `record`:
+
+```js
+import { record } from '@rrweb/record';
+
+record({
+ emit(event) {},
+ captureAssets: {
+ objectURLs: true,
+ origins: ['https://static.example.com'],
+ images: true,
+ video: false,
+ audio: false,
+ stylesheets: 'without-fetch',
+ processStylesheetsWithin: 2000,
+ stylesheetsRuleThreshold: 0,
+ },
+});
+```
+
+## Asset events
+
+Assets are emitted after the `FullSnapshot` or `IncrementalSnapshot` that detected them. Their event timestamp can be later than the related snapshot, but replay still uses the asset with the snapshot it belongs to.
+
+For stylesheets, rrweb can process CSS rules asynchronously and emit them as asset events. This keeps expensive stylesheet serialization out of the initial snapshot path while still letting replay apply the captured stylesheet before visual replay when the asset is available.
+
+## Options
+
+`captureAssets` is an object with these fields:
+
+- `objectURLs` (default: `true`): capture same-origin `blob:` assets created with `URL.createObjectURL()`.
+- `origins` (default: `false`): choose which URL origins rrweb captures. Use `false` or `[]` to disable origin-based capture, `true` to capture from any origin, or an array such as `['https://static.example.com']` to allow specific origins.
+- `images`: capture images even when their origin does not match `origins`. If unset, images are captured only when `origins` matches. `inlineImages: true` maps to `captureAssets.images: true`.
+- `video`: capture video assets even when their origin does not match `origins`. If unset, videos are captured only when `origins` matches.
+- `audio`: capture audio assets even when their origin does not match `origins`. If unset, audio files are captured only when `origins` matches.
+- `stylesheets`: controls stylesheet asset capture. Use `false` to disable it, `'without-fetch'` to capture stylesheets whose CSS rules are already browser-accessible, or `true` to also fetch stylesheet URLs when needed. When stylesheet capture is enabled, including `'without-fetch'`, configured `origins` can allow fetch capture for matching stylesheet URLs.
+- `processStylesheetsWithin` (default: `2000`): maximum delay, in milliseconds, for asynchronous stylesheet processing. Lower values reduce the chance that short visits unload before stylesheet assets are emitted. Set `0` or a negative value to process synchronously, which can block the main thread.
+- `stylesheetsRuleThreshold` (default: `0`): stylesheets with fewer rules than this threshold are processed immediately and included in the snapshot instead of emitted as separate assets.
+
+## Legacy inline options
+
+`inlineImages` and `inlineStylesheet` are still accepted for compatibility, but new integrations should use `captureAssets`.
+
+- `inlineImages: true` maps to `captureAssets.images: true` when `captureAssets.images` is not set.
+- `inlineStylesheet: 'all'` maps to `captureAssets.stylesheets: true`.
+- `inlineStylesheet: true` maps to `captureAssets.stylesheets: 'without-fetch'`.
+- `inlineStylesheet: false` maps to `captureAssets.stylesheets: false`.
+
+When calling `rrweb-snapshot` directly, the historical inline behavior is preserved. The mapping above applies to `record`.
diff --git a/docs/recipes/assets.zh_CN.md b/docs/recipes/assets.zh_CN.md
new file mode 100644
index 0000000000..74f0a32243
--- /dev/null
+++ b/docs/recipes/assets.zh_CN.md
@@ -0,0 +1,53 @@
+# 静态资源录制
+
+静态资源录制会把外部资源记录为 `Asset` 事件,并关联到发现该资源的快照或 mutation。回放时,rrweb 会在重建对应快照时应用这些资源,因此即使原始 URL 不可访问或内容已变化,也可以回放图像、媒体和样式表。
+
+在 `record` 中使用 `captureAssets`:
+
+```js
+import { record } from '@rrweb/record';
+
+record({
+ emit(event) {},
+ captureAssets: {
+ objectURLs: true,
+ origins: ['https://static.example.com'],
+ images: true,
+ video: false,
+ audio: false,
+ stylesheets: 'without-fetch',
+ processStylesheetsWithin: 2000,
+ stylesheetsRuleThreshold: 0,
+ },
+});
+```
+
+## Asset 事件
+
+Asset 事件会在发现它的 `FullSnapshot` 或 `IncrementalSnapshot` 之后发出。事件时间戳可能晚于关联的快照,但回放时仍会把它应用到对应的快照上。
+
+对于样式表,rrweb 可以异步处理 CSS 规则并将结果发为 Asset 事件。这样可以避免在初始快照路径上同步执行较重的样式表序列化,同时在资源可用时仍能让回放先应用捕获到的样式表。
+
+## 配置项
+
+`captureAssets` 是一个对象,包含以下字段:
+
+- `objectURLs`(默认值:`true`):录制通过 `URL.createObjectURL()` 创建的同源 `blob:` 资源。
+- `origins`(默认值:`false`):选择 rrweb 录制哪些 URL origin。使用 `false` 或 `[]` 关闭基于 origin 的录制,使用 `true` 录制任意 origin,或使用 `['https://static.example.com']` 这样的数组指定允许的 origin。
+- `images`:即使图片 origin 不匹配 `origins`,也录制图片资源。未设置时,只有匹配 `origins` 的图片会被录制。`inlineImages: true` 会映射为 `captureAssets.images: true`。
+- `video`:即使视频 origin 不匹配 `origins`,也录制视频资源。未设置时,只有匹配 `origins` 的视频会被录制。
+- `audio`:即使音频 origin 不匹配 `origins`,也录制音频资源。未设置时,只有匹配 `origins` 的音频会被录制。
+- `stylesheets`:控制样式表资源录制。使用 `false` 关闭,使用 `'without-fetch'` 录制浏览器已经可访问 CSS 规则的样式表,使用 `true` 时在需要时也会 fetch 样式表 URL。启用样式表录制时,包括 `'without-fetch'` 模式,配置的 `origins` 可以允许对匹配的样式表 URL 进行 fetch 录制。
+- `processStylesheetsWithin`(默认值:`2000`):异步处理样式表的最长延迟,单位为毫秒。较低的值可以降低短访问在样式表 Asset 发出前卸载页面的概率。设置为 `0` 或负数会同步处理,但可能阻塞主线程。
+- `stylesheetsRuleThreshold`(默认值:`0`):规则数少于该阈值的样式表会立即处理并放入快照,而不是作为单独的 Asset 事件发出。
+
+## 旧的 inline 配置
+
+`inlineImages` 和 `inlineStylesheet` 仍然可以作为兼容配置使用,但新的集成应使用 `captureAssets`。
+
+- `inlineImages: true` 会在 `captureAssets.images` 未设置时映射为 `captureAssets.images: true`。
+- `inlineStylesheet: 'all'` 映射为 `captureAssets.stylesheets: true`。
+- `inlineStylesheet: true` 映射为 `captureAssets.stylesheets: 'without-fetch'`。
+- `inlineStylesheet: false` 映射为 `captureAssets.stylesheets: false`。
+
+直接调用 `rrweb-snapshot` 时,历史 inline 行为仍会保留。以上映射适用于 `record`。
diff --git a/docs/recipes/index.md b/docs/recipes/index.md
index 6f5c71d5d2..72c37d273e 100644
--- a/docs/recipes/index.md
+++ b/docs/recipes/index.md
@@ -10,6 +10,12 @@ Record and Replay is the most common use case, which is suitable for any scenari
[link](./record-and-replay.md)
+### Asset Capture
+
+Asset capture records external resources as asset events so replay can apply images, media, object URLs, and stylesheets even when the original URL is unavailable or has changed.
+
+[link](./assets.md)
+
### Dive Into Events
The events recorded by rrweb are a set of strictly-typed JSON data. You may discover some flexible ways to use them when you are familiar with the details.
diff --git a/docs/recipes/index.zh_CN.md b/docs/recipes/index.zh_CN.md
index 1aa735c29f..ce9c9dd057 100644
--- a/docs/recipes/index.zh_CN.md
+++ b/docs/recipes/index.zh_CN.md
@@ -10,6 +10,12 @@
[链接](./record-and-replay.zh_CN.md)
+### 静态资源录制
+
+静态资源录制会把外部资源记录为 Asset 事件,让回放在原始 URL 不可访问或内容变化时仍能应用图像、媒体、对象 URL 和样式表。
+
+[链接](./assets.zh_CN.md)
+
### 深入录制数据
录制数据是一组类型严格的 JSON 数据,通过熟悉其格式,可以更灵活的使用录制数据。
diff --git a/guide.md b/guide.md
index 59c85c825e..cf16885264 100644
--- a/guide.md
+++ b/guide.md
@@ -203,36 +203,37 @@ setInterval(save, 10 * 1000);
The `record` function accepts the following options.
-| key | default | description |
-| ------------------------ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| emit | required | the callback function to get emitted events |
-| checkoutEveryNth | - | take a full snapshot after every N events
refer to the [checkout](#checkout) chapter |
-| checkoutEveryNms | - | take a full snapshot after every N ms
refer to the [checkout](#checkout) chapter |
-| blockClass | 'rr-block' | Use a string or RegExp to configure which elements should be blocked, refer to the [privacy](#privacy) chapter |
-| blockSelector | null | Use a string to configure which selector should be blocked, refer to the [privacy](#privacy) chapter |
-| ignoreClass | 'rr-ignore' | Use a string or RegExp to configure which elements should be ignored, refer to the [privacy](#privacy) chapter |
-| ignoreSelector | null | Use a string to configure which selector should be ignored, refer to the [privacy](#privacy) chapter |
-| ignoreCSSAttributes | null | array of CSS attributes that should be ignored |
-| maskTextClass | 'rr-mask' | Use a string or RegExp to configure which elements should be masked, refer to the [privacy](#privacy) chapter |
-| maskTextSelector | null | Use a string to configure which selector should be masked, refer to the [privacy](#privacy) chapter |
-| maskAllInputs | false | mask all input content as \* |
-| maskInputOptions | { password: true } | mask some kinds of input \*
refer to the [list](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L77-L95) |
-| maskInputFn | - | customize mask input content recording logic |
-| maskTextFn | - | customize mask text content recording logic |
-| slimDOMOptions | {} | remove unnecessary parts of the DOM
refer to the [list](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L97-L108) |
-| dataURLOptions | {} | Canvas image format and quality ,This parameter will be passed to the OffscreenCanvas.convertToBlob(),Using this parameter effectively reduces the size of the recorded data |
-| inlineStylesheet | true | Deprecated since 2.0.0. Still supported, but planned to be superseded by future `captureAssets` asset recording APIs. |
-| hooks | {} | hooks for events
refer to the [list](https://github.com/rrweb-io/rrweb/blob/9488deb6d54a5f04350c063d942da5e96ab74075/src/types.ts#L207) |
-| packFn | - | refer to the [storage optimization recipe](./docs/recipes/optimize-storage.md) |
-| sampling | - | refer to the [storage optimization recipe](./docs/recipes/optimize-storage.md) |
-| recordCanvas | false | Whether to record the canvas element. Available options:
`false`,
`true` |
-| recordCrossOriginIframes | false | Whether to record cross origin iframes. rrweb has to be injected in each child iframe for this to work. Available options:
`false`,
`true` |
-| recordAfter | 'load' | If the document is not ready, then the recorder will start recording after the specified event is fired. Available options: `DOMContentLoaded`, `load` |
-| inlineImages | false | Deprecated since 2.0.0. Still supported, but planned to be superseded by future `captureAssets` asset recording APIs. |
-| collectFonts | false | whether to collect fonts in the website |
-| userTriggeredOnInput | false | whether to add `userTriggered` on input events that indicates if this event was triggered directly by the user or not. [What is `userTriggered`?](https://github.com/rrweb-io/rrweb/pull/495) |
-| plugins | [] | load plugins to provide extended record functions. [What is plugins?](./docs/recipes/plugin.md) |
-| errorHandler | - | A callback that is called if something inside of rrweb throws an error. The callback receives the error as argument. |
+| key | default | description |
+| ------------------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| emit | required | the callback function to get emitted events |
+| checkoutEveryNth | - | take a full snapshot after every N events
refer to the [checkout](#checkout) chapter |
+| checkoutEveryNms | - | take a full snapshot after every N ms
refer to the [checkout](#checkout) chapter |
+| blockClass | 'rr-block' | Use a string or RegExp to configure which elements should be blocked, refer to the [privacy](#privacy) chapter |
+| blockSelector | null | Use a string to configure which selector should be blocked, refer to the [privacy](#privacy) chapter |
+| ignoreClass | 'rr-ignore' | Use a string or RegExp to configure which elements should be ignored, refer to the [privacy](#privacy) chapter |
+| ignoreSelector | null | Use a string to configure which selector should be ignored, refer to the [privacy](#privacy) chapter |
+| ignoreCSSAttributes | null | array of CSS attributes that should be ignored |
+| maskTextClass | 'rr-mask' | Use a string or RegExp to configure which elements should be masked, refer to the [privacy](#privacy) chapter |
+| maskTextSelector | null | Use a string to configure which selector should be masked, refer to the [privacy](#privacy) chapter |
+| maskAllInputs | false | mask all input content as \* |
+| maskInputOptions | { password: true } | mask some kinds of input \*
refer to the [list](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L77-L95) |
+| maskInputFn | - | customize mask input content recording logic |
+| maskTextFn | - | customize mask text content recording logic |
+| slimDOMOptions | {} | remove unnecessary parts of the DOM
refer to the [list](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L97-L108) |
+| dataURLOptions | {} | Canvas image format and quality ,This parameter will be passed to the OffscreenCanvas.convertToBlob(),Using this parameter effectively reduces the size of the recorded data |
+| inlineStylesheet | true | Deprecated since 2.0.0. Still supported as compatibility input for `captureAssets.stylesheets`. See the [asset capture recipe](./docs/recipes/assets.md). |
+| hooks | {} | hooks for events
refer to the [list](https://github.com/rrweb-io/rrweb/blob/9488deb6d54a5f04350c063d942da5e96ab74075/src/types.ts#L207) |
+| packFn | - | refer to the [storage optimization recipe](./docs/recipes/optimize-storage.md) |
+| sampling | - | refer to the [storage optimization recipe](./docs/recipes/optimize-storage.md) |
+| recordCanvas | false | Whether to record the canvas element. Available options:
`false`,
`true` |
+| recordCrossOriginIframes | false | Whether to record cross origin iframes. rrweb has to be injected in each child iframe for this to work. Available options:
`false`,
`true` |
+| recordAfter | 'load' | If the document is not ready, then the recorder will start recording after the specified event is fired. Available options: `DOMContentLoaded`, `load` |
+| inlineImages | false | Deprecated since 2.0.0. Still supported as compatibility input for `captureAssets.images`. See the [asset capture recipe](./docs/recipes/assets.md). |
+| captureAssets | { objectURLs: true, origins: false, stylesheets: 'without-fetch' } | Configure asset event capture for object URLs, allowed origins, images, video, audio, and stylesheets. The effective stylesheet default comes from legacy `inlineStylesheet: true` mapping to `captureAssets.stylesheets: 'without-fetch'`. See the [asset capture recipe](./docs/recipes/assets.md). |
+| collectFonts | false | whether to collect fonts in the website |
+| userTriggeredOnInput | false | whether to add `userTriggered` on input events that indicates if this event was triggered directly by the user or not. [What is `userTriggered`?](https://github.com/rrweb-io/rrweb/pull/495) |
+| plugins | [] | load plugins to provide extended record functions. [What is plugins?](./docs/recipes/plugin.md) |
+| errorHandler | - | A callback that is called if something inside of rrweb throws an error. The callback receives the error as argument. |
#### Privacy
diff --git a/guide.zh_CN.md b/guide.zh_CN.md
index 570b8d7e7e..cfb7f2d7cf 100644
--- a/guide.zh_CN.md
+++ b/guide.zh_CN.md
@@ -201,35 +201,36 @@ setInterval(save, 10 * 1000);
`record(config)` 的 config 部分接受以下参数
-| key | 默认值 | 功能 |
-| ------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| emit | 必填 | 获取当前录制的数据 |
-| checkoutEveryNth | - | 每 N 次事件重新制作一次全量快照
详见[“重新制作快照”](#重新制作快照)章节 |
-| checkoutEveryNms | - | 每 N 毫秒重新制作一次全量快照
详见[“重新制作快照”](#重新制作快照)章节 |
-| blockClass | 'rr-block' | 字符串或正则表达式,可用于自定义屏蔽元素的类名,详见[“隐私”](#隐私)章节 |
-| blockSelector | null | 所有 element.matches(blockSelector)为 true 的元素都不会被录制,回放时取而代之的是一个同等宽高的占位元素 |
-| ignoreClass | 'rr-ignore' | 字符串或正则表达式,可用于自定义忽略元素的类名,详见[“隐私”](#隐私)章节 |
-| ignoreCSSAttributes | null | 应该被忽略的 CSS 属性数组 |
-| maskTextClass | 'rr-mask' | 字符串或正则表达式,可用于自定义忽略元素 text 内容的类名,详见[“隐私”](#隐私)章节 |
-| maskTextSelector | null | 所有 element.matches(maskTextSelector)为 true 的元素及其子元素的 text 内容将会被屏蔽 |
-| maskAllInputs | false | 将所有输入内容记录为 \* |
-| maskInputOptions | { password: true } | 选择将特定类型的输入框内容记录为 \*
类型详见[列表](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L77-L95) |
-| maskInputFn | - | 自定义特定类型的输入框内容记录逻辑 |
-| maskTextFn | - | 自定义文字内容的记录逻辑 |
-| slimDOMOptions | {} | 去除 DOM 中不必要的部分
类型详见[列表](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L97-L108) |
-| inlineStylesheet | true | 自 2.0.0 起弃用。2.0 中仍受支持,但计划由未来的 `captureAssets` 资源录制 API 取代。 |
-| hooks | {} | 各类事件的回调
类型详见[列表](https://github.com/rrweb-io/rrweb/blob/9488deb6d54a5f04350c063d942da5e96ab74075/src/types.ts#L207) |
-| packFn | - | 数据压缩函数,详见[优化存储策略](./docs/recipes/optimize-storage.zh_CN.md) |
-| sampling | - | 数据抽样策略,详见[优化存储策略](./docs/recipes/optimize-storage.zh_CN.md) |
-| dataURLOptions | {} | Canvas 图像快照的格式和质量,这个参数将传递给 OffscreenCanvas.convertToBlob(),使用这个参数能有效减小录制数据的大小 |
-| recordCanvas | false | 是否记录 canvas 内容, 可用选项:`false`, `true` |
-| recordCrossOriginIframes | false | 是否记录 cross origin iframes。 必须在每个子 iframe 中注入 rrweb 才能使其工作。 可用选项:`false`, `true` |
-| recordAfter | 'load' | 如果 document 还没有加载完成,recorder 将会在指定的事件触发后开始录制。可用选项: `DOMContentLoaded`, `load` |
-| inlineImages | false | 自 2.0.0 起弃用。2.0 中仍受支持,但计划由未来的 `captureAssets` 资源录制 API 取代。 |
-| collectFonts | false | 是否记录页面中的字体文件 |
-| userTriggeredOnInput | false | [什么是 `userTriggered`](https://github.com/rrweb-io/rrweb/pull/495) |
-| plugins | [] | 加载插件以获得额外的录制功能. [什么是插件?](./docs/recipes/plugin.zh_CN.md) |
-| errorHandler | - | 一个可以定制化处理错误的回调函数,它的参数是错误对象。如果 rrweb recorder 内部的某些内容抛出错误,则会调用该回调。 |
+| key | 默认值 | 功能 |
+| ------------------------ | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| emit | 必填 | 获取当前录制的数据 |
+| checkoutEveryNth | - | 每 N 次事件重新制作一次全量快照
详见[“重新制作快照”](#重新制作快照)章节 |
+| checkoutEveryNms | - | 每 N 毫秒重新制作一次全量快照
详见[“重新制作快照”](#重新制作快照)章节 |
+| blockClass | 'rr-block' | 字符串或正则表达式,可用于自定义屏蔽元素的类名,详见[“隐私”](#隐私)章节 |
+| blockSelector | null | 所有 element.matches(blockSelector)为 true 的元素都不会被录制,回放时取而代之的是一个同等宽高的占位元素 |
+| ignoreClass | 'rr-ignore' | 字符串或正则表达式,可用于自定义忽略元素的类名,详见[“隐私”](#隐私)章节 |
+| ignoreCSSAttributes | null | 应该被忽略的 CSS 属性数组 |
+| maskTextClass | 'rr-mask' | 字符串或正则表达式,可用于自定义忽略元素 text 内容的类名,详见[“隐私”](#隐私)章节 |
+| maskTextSelector | null | 所有 element.matches(maskTextSelector)为 true 的元素及其子元素的 text 内容将会被屏蔽 |
+| maskAllInputs | false | 将所有输入内容记录为 \* |
+| maskInputOptions | { password: true } | 选择将特定类型的输入框内容记录为 \*
类型详见[列表](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L77-L95) |
+| maskInputFn | - | 自定义特定类型的输入框内容记录逻辑 |
+| maskTextFn | - | 自定义文字内容的记录逻辑 |
+| slimDOMOptions | {} | 去除 DOM 中不必要的部分
类型详见[列表](https://github.com/rrweb-io/rrweb/blob/588164aa12f1d94576f89ae0210b98f6e971c895/packages/rrweb-snapshot/src/types.ts#L97-L108) |
+| inlineStylesheet | true | 自 2.0.0 起弃用。仍作为 `captureAssets.stylesheets` 的兼容输入受支持。详见[静态资源录制示例](./docs/recipes/assets.zh_CN.md)。 |
+| hooks | {} | 各类事件的回调
类型详见[列表](https://github.com/rrweb-io/rrweb/blob/9488deb6d54a5f04350c063d942da5e96ab74075/src/types.ts#L207) |
+| packFn | - | 数据压缩函数,详见[优化存储策略](./docs/recipes/optimize-storage.zh_CN.md) |
+| sampling | - | 数据抽样策略,详见[优化存储策略](./docs/recipes/optimize-storage.zh_CN.md) |
+| dataURLOptions | {} | Canvas 图像快照的格式和质量,这个参数将传递给 OffscreenCanvas.convertToBlob(),使用这个参数能有效减小录制数据的大小 |
+| recordCanvas | false | 是否记录 canvas 内容, 可用选项:`false`, `true` |
+| recordCrossOriginIframes | false | 是否记录 cross origin iframes。 必须在每个子 iframe 中注入 rrweb 才能使其工作。 可用选项:`false`, `true` |
+| recordAfter | 'load' | 如果 document 还没有加载完成,recorder 将会在指定的事件触发后开始录制。可用选项: `DOMContentLoaded`, `load` |
+| inlineImages | false | 自 2.0.0 起弃用。仍作为 `captureAssets.images` 的兼容输入受支持。详见[静态资源录制示例](./docs/recipes/assets.zh_CN.md)。 |
+| captureAssets | { objectURLs: true, origins: false, stylesheets: 'without-fetch' } | 配置对象 URL、允许的 origin、图片、视频、音频和样式表的 Asset 事件录制。有效的样式表默认值来自旧的 `inlineStylesheet: true` 映射到 `captureAssets.stylesheets: 'without-fetch'`。详见[静态资源录制示例](./docs/recipes/assets.zh_CN.md)。 |
+| collectFonts | false | 是否记录页面中的字体文件 |
+| userTriggeredOnInput | false | [什么是 `userTriggered`](https://github.com/rrweb-io/rrweb/pull/495) |
+| plugins | [] | 加载插件以获得额外的录制功能. [什么是插件?](./docs/recipes/plugin.zh_CN.md) |
+| errorHandler | - | 一个可以定制化处理错误的回调函数,它的参数是错误对象。如果 rrweb recorder 内部的某些内容抛出错误,则会调用该回调。 |
#### 隐私
diff --git a/packages/browser-client/.env.example b/packages/browser-client/.env.example
index 65a95c873f..4d18666e0e 100644
--- a/packages/browser-client/.env.example
+++ b/packages/browser-client/.env.example
@@ -1,3 +1,7 @@
VITE_RRWEB_BROWSER_CLIENT_SERVER_URL=http://localhost:8787/recordings/{recordingId}/events/ws
VITE_RRWEB_BROWSER_CLIENT_API_BASE_URL=http://localhost:8787
+VITE_TEST_PUBLIC_API_KEY=public_key_rr_XXXX
+VITE_TEST_READ_API_KEY=ak_XXXX
+
+# Backward-compatible fallback for tests that still read VITE_TEST_API_KEY.
VITE_TEST_API_KEY=public_key_rr_XXXX
diff --git a/packages/browser-client/README.md b/packages/browser-client/README.md
index 65144a55bd..3940fb4fa0 100644
--- a/packages/browser-client/README.md
+++ b/packages/browser-client/README.md
@@ -51,11 +51,14 @@ rrwebBrowserClient.start({
- `meta`: custom recording metadata sent before recorded events. Built-in diagnostics such as `recordVersion`, `recordCommitHash`, `jsSource`, and `jsEntrypoint` are added automatically after custom metadata. See [Application Metadata](https://rrweb.com/docs/cloud/application-meta).
- `jsSource`: optional source identifier for programmatic loaders. URL values are recorded without query strings or hashes.
- `jsEntrypoint`: optional entrypoint label. Defaults to `programmatic` for direct `start()` calls and `script-tag` for script-tag autostart.
+- `captureAssets`: optional rrweb asset capture configuration. Stylesheet capture defaults to `captureAssets.stylesheets: 'without-fetch'`, so replay can include the CSS needed for the recorded page without fetching stylesheets during recording. Pass your own `captureAssets` object to customize supported rrweb asset capture options.
- rrweb record options: other options are passed through to `record()` from rrweb, such as masking, blocking, sampling, and DOM capture options. See the [rrweb recording docs](https://rrweb.com/docs/packages/record/readme).
### Stylesheet Capture
-`inlineStylesheet` is currently used for stylesheet capture compatibility. Once the `captureAssets` recording API lands from the assets branch, `captureAssets.stylesheets` should replace that compatibility path.
+The browser client enables stylesheet capture by default through `captureAssets.stylesheets`. This records linked stylesheet assets for replay without requiring each caller to configure asset capture manually.
+
+`inlineStylesheet` remains available as a legacy rrweb compatibility option, but new ESM/npm integrations should prefer `captureAssets`.
## Recording Helpers
@@ -79,5 +82,9 @@ Copy `.env.example` to `.env` in this package when running local integration tes
```bash
VITE_RRWEB_BROWSER_CLIENT_SERVER_URL=http://localhost:8787/recordings/{recordingId}/events/ws
VITE_RRWEB_BROWSER_CLIENT_API_BASE_URL=http://localhost:8787
+VITE_TEST_PUBLIC_API_KEY=public_key_rr_XXXX
+VITE_TEST_READ_API_KEY=ak_XXXX
+
+# Backward-compatible fallback for tests that still read VITE_TEST_API_KEY.
VITE_TEST_API_KEY=public_key_rr_XXXX
```
diff --git a/packages/browser-client/src/index.ts b/packages/browser-client/src/index.ts
index dc953fa1bc..49386c1c69 100644
--- a/packages/browser-client/src/index.ts
+++ b/packages/browser-client/src/index.ts
@@ -287,10 +287,12 @@ export function start(
if (recordOptions.maskAllInputs === undefined) {
recordOptions.maskAllInputs = true; // default to more privacy
}
- // TODO: switch this back to captureAssets.stylesheets once rrweb pulls in
- // the captureAssets recording API from the assets branch.
- if (recordOptions.inlineStylesheet === undefined) {
- recordOptions.inlineStylesheet = true;
+ recordOptions.captureAssets = { ...recordOptions.captureAssets };
+ if (
+ recordOptions.captureAssets.stylesheets === undefined &&
+ recordOptions.inlineStylesheet === undefined
+ ) {
+ recordOptions.captureAssets.stylesheets = 'without-fetch';
}
const configEmit = recordOptions.emit;
diff --git a/packages/browser-client/test/autostart.html b/packages/browser-client/test/autostart.html
index e395d2b888..dc39ab6b82 100644
--- a/packages/browser-client/test/autostart.html
+++ b/packages/browser-client/test/autostart.html
@@ -7,7 +7,7 @@