Skip to content
Open
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
14 changes: 13 additions & 1 deletion packages/rrvideo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,22 @@ export async function transformToVideo(options: RRvideoConfig) {
// Wait for the replay to finish
console.log('[DEBUG] Starting replay');
await new Promise<void>((resolve, reject) => {
// Calculate timeout based on event duration and playback speed
const timestamps = events.map((e) => e.timestamp);
const minTimestamp = Math.min(...timestamps);
const maxTimestamp = Math.max(...timestamps);
const eventDuration = maxTimestamp - minTimestamp;
const playbackSpeed = config.rrwebPlayer.speed ?? 1;
// Calculate timeout: event duration / playback speed + 2 minute buffer
const timeoutDuration = Math.ceil(eventDuration / playbackSpeed) + 120000;
console.log(
`[DEBUG] Event duration: ${eventDuration}ms, playback speed: ${playbackSpeed}x, timeout: ${timeoutDuration}ms`,
);

const timeout = setTimeout(() => {
console.error('[DEBUG] Replay timeout - finish event never fired');
reject(new Error('Replay timeout'));
}, 120000); // 2 minute timeout
}, timeoutDuration);

void page
.exposeFunction('onReplayFinish', () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/rrweb-player/.svelte-kit/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ declare module '$env/static/private' {
export const SUDO_GID: string;
export const GITHUB_STATE: string;
export const COPILOT_AGENT_ACTION: string;
export const SECRET_SCANNING_URL: string;
export const npm_package_scripts_test_cross_platform_build: string;
export const npm_package_devDependencies_rollup: string;
export const npm_package_devDependencies__types_node: string;
Expand Down Expand Up @@ -194,6 +195,7 @@ declare module '$env/static/private' {
export const CONDA: string;
export const RUNNER_NAME: string;
export const XDG_CONFIG_HOME: string;
export const COPILOT_USE_ASYNC_SESSIONS: string;
export const GITHUB_REF_NAME: string;
export const GITHUB_REPOSITORY: string;
export const npm_lifecycle_script: string;
Expand Down Expand Up @@ -266,7 +268,6 @@ declare module '$env/static/private' {
export const ANDROID_NDK: string;
export const SGX_AESM_ADDR: string;
export const CHROME_BIN: string;
export const PUPPETEER_SKIP_DOWNLOAD: string;
export const SELENIUM_JAR_PATH: string;
export const MEMORY_PRESSURE_WRITE: string;
export const COPILOT_AGENT_COMMIT_EMAIL: string;
Expand Down Expand Up @@ -315,6 +316,7 @@ declare module '$env/dynamic/private' {
SUDO_GID: string;
GITHUB_STATE: string;
COPILOT_AGENT_ACTION: string;
SECRET_SCANNING_URL: string;
npm_package_scripts_test_cross_platform_build: string;
npm_package_devDependencies_rollup: string;
npm_package_devDependencies__types_node: string;
Expand Down Expand Up @@ -480,6 +482,7 @@ declare module '$env/dynamic/private' {
CONDA: string;
RUNNER_NAME: string;
XDG_CONFIG_HOME: string;
COPILOT_USE_ASYNC_SESSIONS: string;
GITHUB_REF_NAME: string;
GITHUB_REPOSITORY: string;
npm_lifecycle_script: string;
Expand Down Expand Up @@ -552,7 +555,6 @@ declare module '$env/dynamic/private' {
ANDROID_NDK: string;
SGX_AESM_ADDR: string;
CHROME_BIN: string;
PUPPETEER_SKIP_DOWNLOAD: string;
SELENIUM_JAR_PATH: string;
MEMORY_PRESSURE_WRITE: string;
COPILOT_AGENT_COMMIT_EMAIL: string;
Expand Down