FLUTTER ECOSYSTEM

lau1944/just_audio_cache

Coleção de funções de extensão do pacote just_audio para lidar automaticamente com o cache

Capa do projeto just_audio_cache
Stars
15
Forks
7
Último push (UTC)
21 de out. de 2023
Status do projeto
Ativo
Rui. GitHub avatar
GITHUB User

Rui. ↗

Software engineer

LinguagensDartRubySwiftKotlinObjective-C

Pacotes publicados por este repositório

Dependências usadas

Lista de dependências 6 itens

README original

Texto original em inglês. Visite o GitHub para a versão atual.

Expandir / recolher README

just_audio_cache

pub package

Collection of extension function of 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

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

_player.existedInLocal(your_url);

Manually add file to cache

_player.cacheFile(your_audio_url);

Get Cached file for the following url

_player.getCachedFile(url: your_url);

Clear all the cache from storage

_player.clear();