AudioPlayerExtension extension

on
  • AudioPlayer

Methods

cacheFile({required String url, String? path}) Future<void>
clearCache({String? path}) Future<void>
Clear all the cache in the app dir
dynamicSet({required String url, String? path, bool pushIfNotExisted = true, bool excludeCallback(dynamic url)?, bool preload = true}) Future<Duration?>
Get audio from local if exist, otherwise download from network url is your audio source, a unique key that represents the stored file path, path the storage path you want to save your cache pushIfNotExisted if true, when the file not exists, would download the file and push in cache excludeCallback a callback function where you can specify which file you don't want to be cached, (return true if we want to exclude the specific source)
dynamicSetAll(List<String> sources, [String? path, List<String>? excluded]) Future<List<Duration?>>
Cache a collection of audio source sources target sources for your playlist path The dir path where sources store excluded the sources you don't want to save in storage
existedInLocal({required String url}) Future<bool>
Check if the file corresponds the url exists in local
getCachedPath({required String url}) Future<String?>
Get audio file cache path
playFromFile({required String filePath}) Future<void>