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

LibraryParams isRecent & isSuggested combinations #2159

Open
bubenheimer opened this issue Feb 17, 2025 · 4 comments
Open

LibraryParams isRecent & isSuggested combinations #2159

bubenheimer opened this issue Feb 17, 2025 · 4 comments
Assignees
Labels

Comments

@bubenheimer
Copy link

I'd like to add LibraryParams support to my MediaSession. I am not sure how to treat combinations of isRecent and isSuggested, when both are true. I assume the intention is to make those two exclusive, but there is no mention or enforcement of it. Both say to order results in order of relevance. Thanks.

@bubenheimer
Copy link
Author

I suppose onGetItem could reasonably set both isRecent and isSuggested for the same item. Elsewhere this does not seem to make as much sense.

@tonihei
Copy link
Collaborator

tonihei commented Feb 21, 2025

I assume the intention is to make those two exclusive

I think it's perfectly reasonable to set both actually. The session service may not be able to provide a fully accurately sorted list for both values, but an app can choose what it wants to reply with anyway as this is on a best effort basis (e.g. the definition of suggestion or recent can vary by app).

@tonihei tonihei self-assigned this Feb 21, 2025
@bubenheimer
Copy link
Author

Thank you for the clarification. It could be useful to update the documentation a bit on intended usage of LibraryParams. The javadoc on the class itself suggests that it can be used somewhat arbitrarily on the MediaSession side, but some methods in MediaLibrarySession.Callback suggest giving the Browser what it wants.

My conclusion has been to use the most accommodating approach possible: have the MediaSession accept whatever the Browser wants, and return something that it actually has, so that the Browser does not end up empty-handed, because it interprets things differently. So the Session says "You want 'suggested', so I'm giving you 'suggested'", but returning its usual results, because it does not actually support 'suggested', but that seems better than returning nothing to a Browser that uses a different interpretation of how things should work. It's unlikely that the Browser will perform a complex analysis of returned LibraryParams, so I return it data that is similar to what it actually requested.

I wish LibraryParams usage was less wishy-washy.

@tonihei
Copy link
Collaborator

tonihei commented Feb 21, 2025

I wish LibraryParams usage was less wishy-washy

I think that's unavoidable to some extent because of how 'recent' and 'suggested' are open to interpretation.

It could be useful to update the documentation a bit on intended usage of LibraryParams

I'll add a note that multiple flags can be set.

copybara-service bot pushed a commit that referenced this issue Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants