uwex-learning-tech / sbplus-v3

Storybook Plus is a web application for delivering multimedia presentations.
https://media.uwex.edu/our-work/application-showcase/the-storybook-player
GNU General Public License v3.0
2 stars 1 forks source link

Preload and cache all images used on Storybook Pages #86

Closed Lin87 closed 5 years ago

Lin87 commented 6 years ago

Have the images used in the presentation preloaded and cached to avoid image loading situation when the presentation is in progress.

owlboy commented 6 years ago

Be sure to test this in a way that assesses if it is an extra burden on slower devices. And loading in sequentially would be best. Not all at once, I think.

Lin87 commented 6 years ago

Oh yes, definitely. I will load and cache like ~5 images at a time. For example, the first 5 images on page load, when reached page 5, load the next 5 images, and so on.

Lin87 commented 5 years ago

Rather than loading and caching a few images at a time periodically, a worker service thread (multithreading) is created to preload all slide images on the page load. This worker service thread does not affect the loading time of the presentation, which is on the main thread.

Additional image caching controls are added to retain a degree of freshness. That is, cache the image for 1 hour and allow the use of cached images for 2 hours before revalidating with the server. Also, cached images are not stored. In short, the images are cached during the session of user activity.