audio_service icon indicating copy to clipboard operation
audio_service copied to clipboard

Add new optional cacheKeyResolver

Open austinried opened this issue 2 years ago • 1 comments

This PR adds an optional parameter to AudioService.init() that allows specifying a cacheKeyResolver function which specifies how a cache key is resolved for a given MediaItem's art with the cache manager. If no method is specified, the current behavior is kept (the URL is used as the cache key).

This new method allow custom cache key implementations to better support situations where the URL may not be suitable as a cache key. It also brings parity with other packages like cached_network_image which also allows specifying a custom cache key, so if you're using the same cache manager across both libraries you can also use the same cache keys.

Fixes #1001.

Pre-launch Checklist

  • [x] I read the [CONTRIBUTING.md] and followed the process outlined there for submitting PRs.
  • [x] My change is not breaking and lands in minor branch OR my change is breaking and lands in major branch.
  • [x] If I'm the first to contribute to the next version, I incremented the version number in pubspec.yaml according to the [pub versioning philosophy].
  • [x] I updated CHANGELOG.md to add a description of the change (format: * DESCRIPTION OF YOUR CHANGE (@your-git-username)).
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I ran dart analyze.
  • [x] I ran dart format.
  • [x] I ran flutter test and all tests are passing.

austinried avatar Mar 23 '23 01:03 austinried

@ryanheise any thoughts on this API/implementation?

austinried avatar Apr 22 '23 06:04 austinried