Skip to content

Keep the e2e harness preview playing across processor changes - #147

Merged
changt merged 1 commit into
mainfrom
e2e-preview-keep-stream
Oct 21, 2026
Merged

changt merged 1 commit into
mainfrom
e2e-preview-keep-stream

Conversation

@changt

@changt changt commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary

The e2e harness's local preview flickered on mode switches, background swaps, blur radius changes and detach. The cause was the harness, not the SDK. refreshPreview assigned a new MediaStream to the preview's srcObject on every change event, even when the track was unchanged. That restarts the <video> element, which shows the black container background until the next frame arrives.

The preview now keeps one MediaStream for its lifetime and swaps its video track only when the track itself changes, on attach and detach.

Only the on-page preview changes. The probe reads the track directly, so no test measurement is affected.

Measured

Preview element events per action, in headless Chrome:

action before after
switch virtual, swap image, switch blur, blur slider emptied waiting loadstart loadeddata none
detach, attach again emptied waiting loadstart loadeddata none

After each action the preview shows the expected picture: the raw checkerboard after detach, a blurrier background at radius 20 than at 10, and a flat image in virtual-background mode.

Typecheck and all 18 e2e tests pass locally.

refreshPreview assigned a new MediaStream to the preview's srcObject on
every harness change event, which restarts the element and shows black
until the next frame. Mode switches, background swaps, blur radius
changes and detach all flickered. The preview now keeps one stream and
swaps its video track only when the track itself changes.
@changeset-bot

changeset-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 9711d3b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@changt
changt merged commit 7c3b480 into main Oct 21, 2026
3 checks passed
@changt
changt deleted the e2e-preview-keep-stream branch October 21, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants