rasmuslos / ShelfPlayer

Native Audiobookshelf player for iOS & iPadOS
Other
148 stars 15 forks source link

[Feature Request] Show download percentage #28

Closed tehguitarist closed 2 months ago

tehguitarist commented 5 months ago

I’m really sorry about peppering these through, just thinking of helpful in things mostly.

This is probably less useful when downloading on a local network where downloading a book takes seconds, but I was looking around the app when I started a book download, and whilst I found the download indicator on either the book page or the in-app settings page, I noticed that there didn’t seem to be a progress indicator.

From a UX perspective, it might be nice to show that a download is in progress persistently across the various app pages, but more importantly, a progress or download percentage indicator if possible.

That or I start digging into some swift and making PR’s!

I guess less of a request, and more of a question is just around how partial downloads are handled if the app is closed, network is lost, or there is a crash?

rasmuslos commented 5 months ago

Downloads are handled by the system (mostly) so they continue in the background and should work even after the app is terminated. All audio tracks are downloaded using URLSession.downloadTask in parallel. If the app is suspended or terminated while these are running a handler is invoked when a download finishes which will update the status accordingly.

And there lies the problem with a download indicator. It would create a lot of overhead (A progress bar component and at least one additional database model) because the state cannot be stored in memory, as the app can be terminated and the download will resume.

I agree that it is not the best UX but for the moment it will stay. Also suggestions are always welcome, they improve the app :)

JoshStark commented 2 months ago

Apologies for commenting in a closed Issue, but I do think it would be worth thinking about how to improve the UX here. The indeterminate spinner doesn’t make it look like a download is actually occurring. It took me a while to realise the app was doing anything when I downloaded a book.

Was the choice to use the downloadTask handler due to a limitation of some kind? I know Prologue requires the app to be running for the download to work, which obviously isn’t as seamless as what you’ve done, but it might be a worthy sacrifice if it means you can get download speed and progress to display in the app. From a user point of view, it’s very helpful to see to understand the download it working as intended.

rasmuslos commented 2 months ago

I use background url sessions to make downloads work while the app is not in the foreground. I did not know prologue did use normal url session like Infuse, it's really strange because the UX is so much worse.

I thought about better ways to implement progress tracking and using user defaults might work. I did not implement anything yet. Its not impossible, just overhead, but its comparable to normal URL sessions

rasmuslos commented 2 months ago

Added in https://github.com/rasmuslos/ShelfPlayer/commit/beb224d6a5a3b74625d269eafd5b5b1ac23b9fcf

gh0sti commented 2 months ago

Added in https://github.com/rasmuslos/ShelfPlayer/commit/beb224d6a5a3b74625d269eafd5b5b1ac23b9fcf

Will this be in 2.4.1?

rasmuslos commented 2 months ago

No