kiwix / kiwix-apple

Kiwix for offline access on iOS and macOS
https://apple.kiwix.org
GNU Lesser General Public License v3.0
441 stars 70 forks source link

Move video content loading off the main thread #769

Closed BPerlakiH closed 3 weeks ago

BPerlakiH commented 4 weeks ago

On top of: #767 Related to: #744

Creating a more smooth UX, for loading html content, especially large item, such as videos.

The former solution was loading the content (including video content) on the main thread of the application, as part of a synchronised queue. In practice it meant, that the UI became unresponsive while the video was loading.

To solve this, we can read the content on a utility thread, and once completed there, we can send the results back to WebKit.

Before: it was possible to block the UI thread with larger videos (that were not pre-loaded yet), even the "rainbow spinning wheel" was visible on macOS. After: the UI remains responsive (the user can eg. scroll in the meantime), no more system spinning wheel, instead the video loading animation is visible, which is a lot better.

rgaudin commented 3 weeks ago

It's a good thing but that needs to be applied once we've merged the video code in. I'm marking this draft in the mean time so we don't accidentally merge

BPerlakiH commented 3 weeks ago

Implemented separately here: https://github.com/kiwix/kiwix-apple/pull/774