Open swissspidy opened 7 months ago
Some additional notes based on an earlier conversation with @westonruter:
Service worker might be tricky, see https://chromium.googlesource.com/chromium/src/+/main/docs/security/service-worker-security-faq.md#do-service-workers-live-forever
"Chrome also detects long-running workers and terminates them. It does this if an event takes more than 5 minutes to settle, or if the worker is busy running synchronous JavaScript and does not respond to a ping within 30 seconds."
Periodic background sync API likely not suitable either.
It's only available if you installed the PWA to the homescreen and if the site engagement score is high enough
Background fetch API sounds interesting, but more aimed towards downloads
Maybe could do a POC with Workbox / the PWA plugin. See https://github.com/GoogleChromeLabs/pwa-wp/wiki/Service-Worker
Like other plugins this plugin could offer a separate page to allow optimizing the whole media library.
Loop through all media items client-side, skip the ones that are already optimized, and then optimize images and videos
Implementation-wise it could be relatively simple:
Caveats: