Skip to content

Cache background image#100

Merged
1egoman merged 3 commits intomainfrom
cache-background-image
Sep 4, 2025
Merged

Cache background image#100
1egoman merged 3 commits intomainfrom
cache-background-image

Conversation

@1egoman
Copy link
Copy Markdown
Contributor

@1egoman 1egoman commented Sep 4, 2025

Per #91, it seemed like there was some state backgroundImage that was previously in the past being used to cache the background image to keep it from being loaded brand new every time the background is shown.

So, use this state to cache the image data, plus add a cache key on the path so if the path changes, the image will be refetched - from what I can tell, this wasn't being done properly in the past implementation!

A demo video - performance on my relatively speedy Internet seems about the same between the first and nth background toggles with the same image, but I suspect it would make more of a difference on slower internet:

Untitled.mov

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 4, 2025

🦋 Changeset detected

Latest commit: e1399c3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@livekit/track-processors Patch

Not sure what this means? Click here to learn what changesets are.

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

@1egoman 1egoman force-pushed the cache-background-image branch from 30e92b0 to e1399c3 Compare September 4, 2025 17:38
@1egoman 1egoman requested a review from lukasIO September 4, 2025 17:39
Copy link
Copy Markdown
Contributor

@lukasIO lukasIO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing this!

@1egoman 1egoman merged commit 77d1545 into main Sep 4, 2025
4 checks passed
@1egoman 1egoman deleted the cache-background-image branch September 4, 2025 18:23
@github-actions github-actions Bot mentioned this pull request Sep 4, 2025
@Mirzahmet
Copy link
Copy Markdown

Hi. I would be very grateful if you release a new update with this fix. Thank you.

@1egoman
Copy link
Copy Markdown
Contributor Author

1egoman commented Sep 8, 2025

@Mirzahmet Oops, sorry about that - should be published now, see @livekit/track-processors@0.6.1.

holzgeist added a commit to holzgeist/track-processors-js that referenced this pull request Sep 9, 2025
fix: properly bundle for browsers

fix: revert code changes

Reduce the intensity of the gray "flash" when enabling the `BackgroundProcessor` (livekit#96)

Version Packages (livekit#99)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Cache background image (livekit#100)

Version Packages (livekit#101)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants