Skip to content
pubscout

http_cache_stream

0.3.2, released 11 days ago by coltongrubbs.com

Simultaneously downloads, caches, and streams remote content via a local HTTP server.

$ flutter pub add http_cache_stream
Source repository

What it does

Simultaneously downloads, caches, and streams remote web content. It sets up a local HTTP server so standard media players and plugins can immediately play media while it is still downloading.

AI-written summary of version 0.3.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want media players to play remote audio or video files instantly while downloading.
  • You need persistent offline caching for streaming resources.
  • You want range request support for seeking in media players.

Skip it when

  • Your target environment does not permit cleartext local traffic or local server binding.
  • You only need basic asset or file downloading without streaming or media playback integration.

Strengths

  • Allows instant playback of remote media while downloading.
  • Works seamlessly with existing media player plugins via local HTTP URLs.
  • Supports range requests, resumable downloads, and custom headers.

Weaknesses

  • Requires platform-specific configuration for cleartext traffic and local HTTP server usage.
  • Local server sockets can be reclaimed on iOS when the app enters the background, requiring manual reactivation handling.

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
No
Direct dependencies
6

Requires platform configuration to allow cleartext (non-HTTPS) traffic to localhost. iOS/macOS requires an NSAppTransportSecurity entry in Info.plist, and Android requires a network security configuration XML file.

await HttpCacheManager.init();
final sourceUrl = Uri.parse('https://example.com/video.mp4');
final cacheUrl = HttpCacheManager.instance.getCacheUrl(sourceUrl);
final videoPlayerController = VideoPlayerController.networkUrl(cacheUrl);
await videoPlayerController.initialize();
videoPlayerController.play();

Alternatives

Packages that do the same job and could replace http_cache_stream.

  • just_audio

    If you specifically need advanced built-in audio playback and caching capabilities without setting up an external proxy server.

  • video_player

    If you prefer using platform-native caching options built directly into video player implementations.

Works with

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