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

ExoPlayer's DownloadManager download priority #1364

Open
stoyicker opened this issue May 10, 2024 · 0 comments
Open

ExoPlayer's DownloadManager download priority #1364

stoyicker opened this issue May 10, 2024 · 0 comments

Comments

@stoyicker
Copy link

Use case description

My app allows users to download tracks, one at a time, via a queue backed up by ExoPlayer's DownloadManager. It features a screen with a list of all ongoing downloads. Each entry has a button which the user can click to send the download up the list, making it the active one (no concurrency in this case). To try to make it so DownloadManager re-prioritizes clicked downloads, my plan was to remove all others added prior and then add the clicked one back, and re-add all others back. Unfortunately it seems that this ends up in DownloadManager marking downloads to be removed and then undoing so very quickly, often resulting in wrong behavior.

Proposed solution

A new public method on DownloadManager, setDownloadPriority, taking a request id and an int representing a priority, so that download manager always attempts to be downloading the requests with the highest priority, up to the concurrency limit.

Alternative solutions

  • Using different request ids. This will work, but it will waste progress on de-prioritized items, which is undesirable.
  • Separately manage my own queue for full flexibility and have DownloadManager handle truly only ongoing requests, so that DownloadManager only needs to be made aware of "real changes". This will work too, but it feels counterintuitive to have a class like DownloadManager, with thread safety constructs and APIs to handle multiple items, require this additional work on top.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants