From b9f5784de8edb95ce37fa72056f0dc95f9198555 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Wed, 28 May 2025 15:28:25 +0100 Subject: [PATCH 1/3] Don't allow video autoplay to automatically unfreeze page. If it's a 'real' playback, there should be a mount or a keyboard event which will serve to unfreeze the page. Also add other non-user events to the list (we really should have an `isUserEvent` function) --- packages/rrweb/src/record/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 1308c378a6..70704e32c6 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -209,7 +209,15 @@ function record( e.type !== EventType.FullSnapshot && !( e.type === EventType.IncrementalSnapshot && - e.data.source === IncrementalSource.Mutation + [IncrementalSource.Mutation, + IncrementalSource.MediaInteraction, // often automatic e.g. background video loop + IncrementalSource.StyleSheetRule, + IncrementalSource.CanvasMutation, + IncrementalSource.Font, + IncrementalSource.Log, + IncrementalSource.StyleDeclaration, + IncrementalSource.AdoptedStyleSheet, + ].includes(e.data.source) ) ) { // we've got a user initiated event so first we need to apply From f365dcf648385323e366ed24759dd90cea1b5931 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Wed, 28 May 2025 15:31:27 +0100 Subject: [PATCH 2/3] Create chilly-jeans-fail.md --- .changeset/chilly-jeans-fail.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/chilly-jeans-fail.md diff --git a/.changeset/chilly-jeans-fail.md b/.changeset/chilly-jeans-fail.md new file mode 100644 index 0000000000..00ae586a1c --- /dev/null +++ b/.changeset/chilly-jeans-fail.md @@ -0,0 +1,5 @@ +--- +"rrweb": patch +--- + +Don't allow video/audio autoplay to automatically unfreeze page From ec3622226f0faf0ba239b39609b44c2c9da15d05 Mon Sep 17 00:00:00 2001 From: eoghanmurray Date: Wed, 28 May 2025 14:37:16 +0000 Subject: [PATCH 3/3] Apply formatting changes --- packages/rrweb/src/record/index.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 70704e32c6..e4f0f8a777 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -209,15 +209,16 @@ function record( e.type !== EventType.FullSnapshot && !( e.type === EventType.IncrementalSnapshot && - [IncrementalSource.Mutation, - IncrementalSource.MediaInteraction, // often automatic e.g. background video loop - IncrementalSource.StyleSheetRule, - IncrementalSource.CanvasMutation, - IncrementalSource.Font, - IncrementalSource.Log, - IncrementalSource.StyleDeclaration, - IncrementalSource.AdoptedStyleSheet, - ].includes(e.data.source) + [ + IncrementalSource.Mutation, + IncrementalSource.MediaInteraction, // often automatic e.g. background video loop + IncrementalSource.StyleSheetRule, + IncrementalSource.CanvasMutation, + IncrementalSource.Font, + IncrementalSource.Log, + IncrementalSource.StyleDeclaration, + IncrementalSource.AdoptedStyleSheet, + ].includes(e.data.source) ) ) { // we've got a user initiated event so first we need to apply