搜尋套件、儲存庫與 APP 分類

套件詳情v0.1.2

just_audio_cache

[just_audio](https://pub.dev/packages/just_audio) 包的擴展函數集合,用於自動處理音訊檔案快取

AndroidiOSmacOS
近 30 天下載
245
喜歡數
47
Pub 分數
130

安裝套件

flutter pub add just_audio_cache

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

just_audio_cache 是一個 Flutter 套件,它擴展了 just_audio 庫,並提供自動音頻檔案快取功能。它透過智慧管理已快取的音頻檔案,簡化離線播放,減少重複下載並提升效能。此套件與 just_audio 無縫整合,提供延伸方法來處理快取邏輯,無需手動干預。適用於經常串流或播放音頻內容的應用程式,確保高效使用儲存空間,並在後續播放時實現更快的載入速度。

適用情境

  • 離線音頻播放
  • 減少資料使用
  • 更快的音頻加載
  • 串流應用增強
  • 快取遠端音訊檔案
  • 在低連接性區域提升使用者體驗

主要特色

  • 自動緩存音頻文件
  • 與 just_audio 的無縫整合
  • 用於方便使用的擴展方法
  • 高效的存儲管理
  • 對多個平台的支援
  • 可設定的快取大小

適合對象

  • 音頻串流應用
  • 播客播放器
  • 音樂應用
  • 頻繁播放音訊的應用
  • 使用 just_audio 的開發者
  • 優先考慮離線功能的專案

使用建議

  • 需要安裝 just_audio
  • 快取大小必須手動管理
  • 快取政策的自訂功能有限
  • 不適用於非常大的音訊圖書館
  • 某些平台可能需要額外權限
  • 依賴於平台特定的儲存行為

原始 README

以下為關聯原始碼儲存庫的 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();

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。