Skip to content
pubscout

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.

$ flutter pub add cached_video_player_plus
Source repository

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.

Works with

Packages commonly used together with cached_video_player_plus: ones it builds on, ones built on it, and its own family.