cached_video_player_plus
4.1.0, released 12 months ago by outdatedguy.rocks
Drop-in wrapper for video_player that caches videos for offline playback.
What it does
Extends the video_player plugin to seamlessly cache videos on the device for offline playback and zero buffering on repeat views. Provides pre-caching, custom cache keys, and cache management tools.
AI-written summary of version 4.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to cache network videos to reduce bandwidth and eliminate buffering on repeat views.
- You need a drop-in replacement for video_player with offline support.
Skip it when
- You need to stream HLS (.m3u8), DASH, or live streams.
- You are targeting platforms where video playback requires additional workarounds unless you implement them.
Strengths
- Zero buffering on repeat views via local caching.
- Pre-caching support to download videos before playback.
- Custom cache keys and easy cache clearing mechanisms.
Weaknesses
- Does not support HLS (.m3u8), DASH, or live streams.
- Requires dependency overrides for certain platforms or specific bug fixes in underlying packages like flutter_cache_manager.
- Windows and Linux require additional packages for video playback.
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 4
Follow setup instructions for video_player and handle platform-specific dependencies (such as video_player_win or video_player_media_kit for Windows/Linux if required). May need dependency overrides for flutter_cache_manager or get_storage in certain scenarios.
class VideoExample extends StatefulWidget {
const VideoExample({super.key});
@override
_VideoExampleState createState() => _VideoExampleState();
}
class _VideoExampleState extends State<VideoExample> {
late final CachedVideoPlayerPlus _player;
@override
void initState() {
super.initState();
_player = CachedVideoPlayerPlus.networkUrl(
Uri.parse('https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'),
);
_player.initialize().then((_) {
setState(() {});
_player.controller.play();
});
}
@override
void dispose() {
_player.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: _player.isInitialized
? AspectRatio(
aspectRatio: _player.controller.value.aspectRatio,
child: VideoPlayer(_player.controller),
)
: const CircularProgressIndicator.adaptive(),
),
);
}
}Alternatives
Packages that do the same job and could replace cached_video_player_plus.
- video_player_android
Android implementation of the video_player plugin
88Compare - video_player_avfoundation
iOS and macOS implementation of the video_player plugin
86Compare - video_player_tizen
Tizen implementation of the video_player plugin.
71Compare - video_player_macos
MacOS implementation of the video_player plugin.
34Compare
Works with
Packages commonly used together with cached_video_player_plus: ones it builds on, ones built on it, and its own family.
- shared_preferencescached_video_player_plus depends on itFlutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.
- flutter_cache_managercached_video_player_plus depends on itGeneric cache manager for saving web files and cache info on device storage.
- video_playercached_video_player_plus depends on itFlutter plugin for displaying inline video on Android, iOS, macOS, and web.
- get_storagecached_video_player_plus depends on itSynchronous key‑value storage with in‑memory cache and automatic disk backup.
- adaptive_video_playerBuilt on cached_video_player_plusFlutter video player package for YouTube and direct video URLs with adaptive controls.