1

I'm working on an Android app where I display a list of local audio files. Currently, I'm using ContentResolver.loadThumbnail() to get the thumbnails (album art) for these audio files, but this method takes some time and causes delays in UI rendering.

I'm already using the Coil library for image loading and caching in my app, and I'd like to use it to load the audio file thumbnails more efficiently.

Here’s a simplified version of what I currently do:

val thumbnail = contentResolver.loadThumbnail(
    uri,
    Size(200, 200),
    null
)

Is there a way to use Coil to load these thumbnails directly using the uri or MediaStore data? Or is there a recommended way to wrap loadThumbnail so that Coil handles the loading and caching in the background?

Any help or code examples would be appreciated!

3
  • See github.com/coil-kt/coil/issues/922#issuecomment-937085745 and ryanharter.com/blog/2024/04/extending-coil Commented May 24 at 22:45
  • Thank you for sharing , but non of these links helped me out to solve this issue do you have any additional resource to solve the issue Commented May 25 at 4:48
  • You stated that you already have working code to loading the images and simply wanted to add them to Coil. "non of these links helped me out to solve this issue" -- the first link is to a Coil issue about your question, specifically to the solution: "you can add custom Fetchers to Coil". The second link shows how to create custom fetchers and add them to Coil. Commented May 25 at 10:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.