precache static method

Future<StreamController<Map>?> precache(
  1. String url, {
  2. Map<String, Object>? headers,
  3. int cacheSegments = 2,
  4. bool downloadNow = true,
  5. bool progressListen = false,
  6. int priority = 1,
})

Pre-caches the video at the specified url.

url: The video URL to be pre-cached. headers: Optional HTTP headers for the request. cacheSegments: Number of segments to cache (default: 2). downloadNow: If true, downloads segments immediately; if false, pushes to the queue (default: true). progressListen: If true, returns a StreamController with progress updates (default: false). priority: Higher-priority tasks are scheduled before lower-priority queued preloads.

Returns a StreamController emitting progress/status updates, or null if not listening.

Implementation

static Future<StreamController<Map>?> precache(
  String url, {
  Map<String, Object>? headers,
  int cacheSegments = 2,
  bool downloadNow = true,
  bool progressListen = false,
  int priority = 1,
}) {
  return UrlParserFactory.createParser(url.toSafeUri()).precache(
    url,
    headers,
    cacheSegments,
    downloadNow,
    progressListen,
    priority,
  );
}