-
Notifications
You must be signed in to change notification settings - Fork 556
Formal API to allow apps to handle playback resumption themselves #2458
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
base: main
Are you sure you want to change the base?
Conversation
Thanks for the suggestions! This PR currently mixes multiple things together, and it may be helpful to untangle this a bit. As far as I can see, there are 3 proposals here:
|
Hi @tonihei, thanks for your feedback.
Yes, I don't think it's a problem to do that though as while the wrong path might be more expensive, it will not be functionally wrong. I also did some basic testing and didn't see SystemUI querying playback resumption while paused during that testing. Though I admit that it'd be better to detect that, I am not sure how that would work. I'll file an issue (edit: #2578) to discuss further and drop it from the PR for now. If we find a better way, great, and if not I can push the commit again into a new PR.
My usecase is actually just setShuffleOrder. Can't do that before setMediaItems (I get IllegalArgumentException iirc), but if library calls setMediaItems I don't see any non-racy way to add a setShuffleOrder call after that. For now I've hacked my ShuffleOrder to just return a predefined result in cloneAndInsert if something is loaded to disk, but it's rather suboptimal hack.
The idea is that app code calls setException on the SettableFuture it returns from onPlaybackResumption when it wants to manually do playback resumption.
I agree this is useful on it's own, but I specifically added it to go hand-in-hand with manually handling playback resumption, as manual handling only makes sense if we want to actually play stuff. I am not opposed to adding that first if you think the manual handling makes no sense or needs to be iterated upon first, though. Let me know whether I should split out manual handling as well. |
This could previously be achieved by inspecting stack trace of onPlaybackResumption() and then returning settable future that will never be set, but this API adds a cleaner way and makes the caveats of this clearer. Issue: androidx#1764
This could previously be achieved by inspecting stack trace of
onPlaybackResumption() and then returning settable future that will
never be set, but this API adds a cleaner way and makes the caveats
of this clearer.
Issue: #1764