Flutter video_player unable to play a few videos from file


I’m building a Flutter app that takes a list of video clip URL’s from Firebase, downloads them to storage and stores the file paths. Afterwards the user can go through the list of video paths and play the video clips that has been downloaded. This is done with the Flutter video_player.


It should be pretty straight forward, but for some reason, some of the video clips can’t be loaded and played by the VideoPlayerController.
All the video clips are in the exact same format, having been rendered, compressed and uploaded the same way.

Each video clip is downloaded to storage like this:

var dir = await getApplicationDocumentsDirectory();
String filePath = "video/$index.mp4";
String fullPath = dir.path + filePath;
Response videoResponse = await dio.download(videoUrl, fullPath);

if (videoResponse.statusCode == 200) {
      videoPath = fullPath;
      print("Downloaded: $filePath");
    } else {
      print("Download error")

The videoPathwill then be stored in a list and sent the screen containing the video player.

Inside the video player screen, that is how it will load the video clips from file:

_controller = VideoPlayerController.file(
    new File(videos[index].videoPath));

_initPlayerFuture = _controller.initialize();

This code will use index to change between each file in the list.

When I run this, about 50% of the clips will load and play perfectly, while the others will return the following error on log:

E/ExoPlayerImplInternal(27253): Source error.
E/ExoPlayerImplInternal(27253): com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor, AmrExtractor) could read the stream.
E/ExoPlayerImplInternal(27253):     at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractorHolder.selectExtractor(ExtractorMediaPeriod.java:973)
E/ExoPlayerImplInternal(27253):     at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:891)
E/ExoPlayerImplInternal(27253):     at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:381)
E/ExoPlayerImplInternal(27253):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
E/ExoPlayerImplInternal(27253):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
E/ExoPlayerImplInternal(27253):     at java.lang.Thread.run(Thread.java:764)

I seem to have isolated the problem to the way I save the videoclips to storage (See NOTES), but that doesn’t explain why some clips work and others don’t.

Does anybody know what might be going on, and how to fix it? Or have anybody had the same issue, and might have some experience to share?

Thanks in advance!


  • Whenever I skip the download-to-storage-process, and just use VideoPlayerController.network(videos[index].videoUrl) all the videos will play without any issues. It’s important however, that all the videoclips are downloaded at the same time in the beginning.

  • It’s the same clips each time that either works or not, and it doesn’t matter what position they come in.

  • I’ve check up on all the paths getting sent to the VideoPlayerController, and they’re all correctly stored and shared with the video player.

  • Might be related to this post: Flutter video_player not playing video saved to application directory


I figured out the issue.
Further down in the download process, I’m downloading some meta data for each video clip, which includes other media files. For some reason I was specifying the same saving file path for some of these files, as for the video clips. They’re simply overwriting each over. As only some of the video clips has this media files in the meta data, that was what caused the error to only show on certain clips.

Answered By – Claes Zacho

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *