Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): preload assets in photo-viewer #7920

Merged
merged 3 commits into from Mar 14, 2024

Conversation

samholton
Copy link
Contributor

@samholton samholton commented Mar 13, 2024

Adding preloadAssets = writable<AssetResponseDto[]>([]); to asset-viewing.store to allow one or more assets to be preloaded after the primary asset has been loaded.

Design choices:

  1. Only preload assets if they are of type AssetTypeEnum.Image, didn't want to interfere with video streaming
  2. Only preload assets if primary asset is image - didn't want to interfere with video streaming
  3. For stacks, preload the next image as well as the second image in the stack
  4. Does not preload when initially selecting an asset - although we could preload both the previous and next until we know which direction they are going

The actual loading is currently in photo-viewer because it has the information when the primary is finished loading as well as the helper downloadRequest. Although maybe it makes sense to add an event when primary loading is done and do pre-loading in asset-grid or asset-viewer?

Tested by clearing cache, not enabling disable cache, and setting throttling to a slower connection. Tested both navigating around as well as slideshow.

Does not address the issue in Firefox and the XHR abort not happening.

before without preload
before.webm

after with preload
after with preload.webm

@alextran1502 alextran1502 merged commit ab4b8ec into immich-app:main Mar 14, 2024
23 checks passed
@samholton samholton deleted the feature/preload-images branch March 14, 2024 21:47
@jvgoch
Copy link

jvgoch commented Mar 23, 2024

Great feature! Unfortunately it doesn't work when the slideshow is set to shuffle. Should I create an issue on the github for this?

@samholton
Copy link
Contributor Author

Will see if I can take a look this weekend at preloading when in shuffle mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants