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

MediaSession Notification not loading content:// URIs. #327

Open
Guardiannw opened this issue Apr 15, 2023 · 4 comments
Open

MediaSession Notification not loading content:// URIs. #327

Guardiannw opened this issue Apr 15, 2023 · 4 comments
Assignees

Comments

@Guardiannw
Copy link

Guardiannw commented Apr 15, 2023

[REQUIRED] Use case description

Currently, the notification displayed from the MediaSession loads URIs from the web via https:// but it does not load content:// URIs. This is catalogued but never followed up in issue #9 at the final comment.

Proposed solution

Adjusted the Bitmap loader to also load content URIs.

Alternatives considered

None

@marcbaechinger
Copy link
Contributor

There is DataSourceBitmpaLoader in the main branch that we will release with 1.1.0 I think.

This bitmap loader can handle content:// URIs.

Can you give a bit more detail what use case is not working with content:// URIs?

Because I actually thought that if a URI with content:// scheme is delivered to the System UI as artworkUri I'd actually expect that System UI would download that bitmap instead of the Media3 library.

@Guardiannw
Copy link
Author

Thanks for the response Marc. So, the way that it seems to work right now, if the content URI is provided via artworkUri, it does work in some scenarios, such as in Android Auto, but it does not work with the default notification provided by MediaSession. I think this is just because the SimpleBitmapLoader doesn't support the content:// URIs by default. In the event a content:// URI is supplied currently, the notification simply has a white background with no image. It seemed like this should be something that is included since it is such a common thing, especially when working with media, however, the DataSourceBitmapLoader you mentioned might be an appropriate solution. Right now I have gotten around the issue by creating my own BitmapLoader, but it just seemed like something that should be supported by default.

@marcbaechinger
Copy link
Contributor

Ah, yes sorry, my bad. It only works on API 33 without converting the URI to a bitmap, because before API 33 we need to use the largeIcon of the notification for it and this requires to use a byte array.

We will include the DataSourceBitmapLoader into 1.1.0 and also change the demo app to use this. I leave this enhancement open until we have done this. Thanks for reporting!

rohitjoins pushed a commit that referenced this issue Apr 18, 2023
Issue: #327
PiperOrigin-RevId: 525103046
@PaulWoitaschek
Copy link
Contributor

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

3 participants