Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lau1944/just_audio_cache
Collection of extension function of just_audio package for auto-handle caching
https://github.com/lau1944/just_audio_cache
Last synced: 5 days ago
JSON representation
Collection of extension function of just_audio package for auto-handle caching
- Host: GitHub
- URL: https://github.com/lau1944/just_audio_cache
- Owner: lau1944
- License: mit
- Created: 2021-08-04T09:26:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-21T02:13:09.000Z (about 1 year ago)
- Last Synced: 2023-10-21T03:21:00.639Z (about 1 year ago)
- Language: Dart
- Size: 105 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# just_audio_cache
[![pub package](https://img.shields.io/pub/v/just_audio_cache.svg)](https://pub.dev/packages/just_audio_cache)
Collection of extension function of [just_audio](https://pub.dev/packages/just_audio) package for auto-handle caching audio files
## How to use
The premise is you already have just_audio package in your dependency
Core method `dynamicSet` would auto handle caching, if the target file not in cache, would download it and push in cache.
The next time the same url request call, would call the local file instead of requesting.
`url` is your audio source, a unique key that represents the stored file path,
`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
```dart
import 'package:just_audio_cache/just_audio_cache.dart';void _play() async {
// dynamic set your audio source
await _player.dynamicSet(your_url);
_player.play();
}
```If you want to check if the target file exist in cache
```dart
_player.existedInLocal(your_url);
```Manually add file to cache
```dart
_player.cacheFile(your_audio_url);
```Get Cached file for the following url
```dart
_player.getCachedFile(url: your_url);
```Clear all the cache from storage
``` dart
_player.clear();
```