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

Fallback image for media items with missing arts #309

Open
nuc134r opened this issue May 9, 2020 · 2 comments · May be fixed by #992
Open

Fallback image for media items with missing arts #309

nuc134r opened this issue May 9, 2020 · 2 comments · May be fixed by #992
Assignees
Labels
1 backlog enhancement New feature or request

Comments

@nuc134r
Copy link

nuc134r commented May 9, 2020

Is your feature request related to a problem? Please describe.
Not all tracks in my situation have an art image and that makes the Android notification layout different if an image url is provided or null. It makes it hard to skip a lot of tracks because layout jumps around and you have to move your finger a lot.

Some android versions I've seen (eg MIUI) even cache images that are removed from Android media items and show them even if current item does not have art image.

Describe the solution you'd like
I'd like to have an option to specify an abstract fallback image for tracks that don't have an image so that layout of notification is preserved. The most suitable place I can see for this option specification is one more param for AudioService.start(). It might be a string that contains Android or even Flutter resource name since they are available on Android side.

Describe alternatives you've considered
Since you cannot get a file url to a Flutter or Android resource it's pretty straightforward that I need to fill a missing artUri with a file:// path to an image pre-copied into app storage. But user can clean app storage so I need to check if the fallback art is copied on every launch which is sophisticated. Also it requires me to write platform code.

Additional context
Following GIF illustrates the case of layout jumps around.

1313123

@nuc134r nuc134r added 1 backlog enhancement New feature or request labels May 9, 2020
@ryanheise
Copy link
Owner

Since artwork is currently handled with URIs, I would prefer this to also be done through a URI rather than a Flutter asset. Note that audio_service uses flutter_cache_manager to fetch the art from URIs, so in fact you can also host the placeholder artwork at a remote URL and the first time it's needed it will be cached by flutter_cache_manager and then the local cached file will be automatically used thereafter.

So a simple solution to your issue is to host the placeholder art elsewhere, and then for each media item that doesn't have an artwork, pass in the URI for your placeholder. If you prefer not to load any remote URLs, then yes you'll need some application logic in your onStart to check for the existence of your local placeholder file, and if it doesn't exist, fetch it from Flutter assets.

I do think a placeholder URI could be a useful feature, though, so I'll leave this feature request open. But in the meantime, you should at least be able to work around it with application code.

@nuc134r
Copy link
Author

nuc134r commented May 10, 2020

Hosted placeholder is something I never came up with. Thanks, Ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 backlog enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants