Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"rrdom-nodejs",
"rrweb-player",
"@rrweb/types",
"@rrweb/web-extension"
"@rrweb/web-extension",
"rrvideo"
]
],
"linked": [],
Expand Down
5 changes: 5 additions & 0 deletions .changeset/tricky-panthers-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'rrvideo': patch
---

Refactor: Move rrvideo to rrweb's monorepo
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ body:
- rrweb-snapshot
- rrdom
- rrweb-player
- web-extension
- rrvideo
- Other (specify below)
validations:
required: true
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ body:
- rrweb-snapshot
- rrdom
- rrweb-player
- web-extension
- rrvideo
- Other (specify below)
validations:
required: true
Expand Down
1 change: 1 addition & 0 deletions .vscode/rrweb-monorepo.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"name": "web-extension (package)",
"path": "../packages/web-extension"
},
{ "name": "rrvideo (package)", "path": "../packages/rrvideo" },
{ "name": "@rrweb/types", "path": "../packages/types" }
],
"settings": {
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@
"eslint-plugin-compat": "^4.0.2",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-tsdoc": "^0.2.16",
"lerna": "^4.0.0",
"markdownlint": "^0.25.1",
"markdownlint-cli": "^0.31.1",
"prettier": "2.8.4",
"turbo": "^1.2.4",
"typescript": "^4.7.3"
},
"scripts": {
"lerna": "lerna",
"build:all": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references' 'yarn turbo run prepublish'",
"test": "yarn run concurrently --success=all -r -m=1 'yarn workspaces-to-typescript-project-references --check' 'yarn turbo run test'",
"test:watch": "yarn turbo run test:watch",
Expand Down
3 changes: 1 addition & 2 deletions packages/rrdom-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-web-worker-loader": "^1.6.1",
"ts-jest": "^27.1.3",
"typescript": "^4.7.3"
"ts-jest": "^27.1.3"
},
"dependencies": {
"cssom": "^0.5.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/rrdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-web-worker-loader": "^1.6.1",
"ts-jest": "^27.1.3",
"typescript": "^4.7.3"
"ts-jest": "^27.1.3"
},
"dependencies": {
"rrweb-snapshot": "^2.0.0-alpha.6"
Expand Down
37 changes: 37 additions & 0 deletions packages/rrvideo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# rrvideo

[中文文档](./README.zh_CN.md)

rrvideo is a tool for transforming the session recorded by [rrweb](https://github.com/rrweb-io/rrweb) into a video.

## Install rrvideo

1. Install [ffmpeg](https://ffmpeg.org/download.html)。
2. Install [Node.JS](https://nodejs.org/en/download/)。
3. Run `npm i -g rrvideo` to install the rrvideo CLI。

## Use rrvideo

### Transform a rrweb session(in JSON format) into a video.

```shell
rrvideo --input PATH_TO_YOUR_RRWEB_EVENTS_FILE
```

Running this command will output a `rrvideo-output.mp4` file in the current working directory.

### Config the output path

```shell
rrvideo --input PATH_TO_YOUR_RRWEB_EVENTS_FILE --output OUTPUT_PATH
```

### Config the replay

You can prepare a rrvideo config file and pass it to CLI.

```shell
rrvideo --input PATH_TO_YOUR_RRWEB_EVENTS_JSON_FILE --config PATH_TO_YOUR_RRVIDEO_CONFIG_FILE
```

You can find an example of the rrvideo config file [here](./rrvideo.config.example.json).
35 changes: 35 additions & 0 deletions packages/rrvideo/README.zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# rrvideo

rrvideo 是用于将 [rrweb](https://github.com/rrweb-io/rrweb) 录制的数据转为视频格式的工具。

## 安装 rrvideo

1. 安装 [ffmpeg](https://ffmpeg.org/download.html)。
2. 安装 [Node.JS](https://nodejs.org/en/download/)。
3. 执行 `npm i -g rrvideo` 以安装 rrvideo CLI。

## 使用 rrvideo

### 将一份 rrweb 录制的数据(JSON 格式)转换为视频。

```shell
rrvideo --input PATH_TO_YOUR_RRWEB_EVENTS_FILE
```

运行以上命令会在执行文件夹中生成一个 `rrvideo-output.mp4` 文件。

### 指定输出路径

```shell
rrvideo --input PATH_TO_YOUR_RRWEB_EVENTS_FILE --output OUTPUT_PATH
```

### 对回放进行配置

通过编写一个 rrvideo 配置文件再传入 rrvideo CLI 的方式可以对回放进行一定的配置。

```shell
rrvideo --input PATH_TO_YOUR_RRWEB_EVENTS_JSON_FILE --config PATH_TO_YOUR_RRVIDEO_CONFIG_FILE
```

rrvideo 配置文件可参考[示例](./rrvideo.config.example.json)。
28 changes: 28 additions & 0 deletions packages/rrvideo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "rrvideo",
"version": "2.0.0-alpha.6",
"description": "transform rrweb session into video",
"main": "build/index.js",
"bin": {
"rrvideo": "build/cli.js"
},
"files": [
"build"
],
"types": "build/index.d.ts",
"scripts": {
"build": "tsc",
"prepublish": "yarn build"
},
"author": "[email protected]",
"license": "MIT",
"devDependencies": {
"@types/minimist": "^1.2.1",
"@rrweb/types": "^2.0.0-alpha.6"
},
"dependencies": {
"minimist": "^1.2.5",
"puppeteer": "^19.7.2",
"rrweb-player": "^2.0.0-alpha.6"
}
}
10 changes: 10 additions & 0 deletions packages/rrvideo/rrvideo.config.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"width": 1400,
"height": 900,
"speed": 4,
"skipInactive": true,
"mouseTail": {
"strokeStyle": "green",
"lineWidth": 2
}
}
39 changes: 39 additions & 0 deletions packages/rrvideo/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env node
import * as fs from 'fs';
import * as path from 'path';
import minimist from 'minimist';
import type { RRwebPlayerOptions } from 'rrweb-player';
import { transformToVideo } from './index';

const argv = minimist(process.argv.slice(2));

if (!argv.input) {
throw new Error('please pass --input to your rrweb events file');
}

let config = {};

if (argv.config) {
const configPathStr = argv.config as string;
const configPath = path.isAbsolute(configPathStr)
? configPathStr
: path.resolve(process.cwd(), configPathStr);
config = JSON.parse(fs.readFileSync(configPath, 'utf-8')) as Omit<
RRwebPlayerOptions['props'],
'events'
>;
}

transformToVideo({
input: argv.input as string,
output: argv.output as string,
rrwebPlayer: config,
})
.then((file) => {
console.log(`Successfully transformed into "${file}".`);
})
.catch((error) => {
console.log('Failed to transform this session.');
console.error(error);
process.exit(1);
});
Loading