VideoPlayerController.file constructor

VideoPlayerController.file(
  1. File file, {
  2. Future<ClosedCaptionFile>? closedCaptionFile,
  3. VideoPlayerOptions? videoPlayerOptions,
  4. Map<String, String> httpHeaders = const <String, String>{},
})

Constructs a VideoPlayerController playing a video from a file.

This will load the file from a file:// URI constructed from file's path. httpHeaders option allows to specify HTTP headers, mainly used for hls files like (m3u8).

Implementation

VideoPlayerController.file(File file,
    {Future<ClosedCaptionFile>? closedCaptionFile,
    this.videoPlayerOptions,
    this.httpHeaders = const <String, String>{}})
    : _closedCaptionFileFuture = closedCaptionFile,
      dataSource = Uri.file(file.absolute.path).toString(),
      dataSourceType = DataSourceType.file,
      package = null,
      formatHint = null,
      super(const VideoPlayerValue(duration: Duration.zero));