Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Flutter video_player fails on Android with ExoPlaybackException: Source error

ErrorPlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null)

Short answer

A source error means ExoPlayer could not load or read the URL. In a Flutter app the usual reasons are: the INTERNET permission is missing, the URL is plain http, a redirect switches between https and http, or an HLS stream is not recognised as HLS. Test each one in that order.

  • Applies to Flutter 3.3x stable, video_player 2.x, Android 14 and later
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the Android log while the video starts. The line printed under the exception names the real cause.

    adb logcat | grep -i -E "exoplayer|media3|cleartext|extractor"
  2. 2Match what you see, then jump to its fix

    1. 1Every network URL fails, including https ones, while asset videos playThe INTERNET permission is missing from the manifestFix
    2. 2The log mentions Cleartext HTTP traffic not permittedThe URL uses http and cleartext traffic is blockedFix
    3. 3The server answers 301 or 302 and the final location uses the other protocolThe stream redirects between https and httpFix
    4. 4The log shows UnrecognizedInputFormatException, often for a URL that does not end in .m3u8An HLS stream is not recognised as HLSFix

What does the error look like?

  • PlatformException(VideoError, Video player had error com.google.android.exoplayer2.ExoPlaybackException: Source error, null, null)
  • Cleartext HTTP traffic not permitted
  • UnrecognizedInputFormatException: None of the available extractors could read the stream.

Cause 1 of 4

The INTERNET permission is missing from the manifest

1Check

The video_player docs say network videos need the INTERNET permission in the app manifest.

grep -n "INTERNET" android/app/src/main/AndroidManifest.xml

2Fix

Add the permission inside the manifest tag, above the application tag.

<uses-permission android:name="android.permission.INTERNET"/>

3Verify

Rebuild fully (not hot reload) and play the same URL.

flutter run

Confirmed by pub.dev

Did this fix it?

Cause 2 of 4

The URL uses http and cleartext traffic is blocked

1Check

If the app targets Android 9 (API 28) or higher, cleartext HTTP is disabled by the default network configuration.

grep -n "usesCleartextTraffic" android/app/src/main/AndroidManifest.xml

2Fix

Best: serve the stream over https. If you must allow http for a test server, add the attribute to the application element, or use a Network Security Configuration that allows only that host.

<application
    android:usesCleartextTraffic="true"
    ... >

3Verify

Rebuild and play the URL again.

flutter run

Confirmed by developer.android.com

Did this fix it?

Cause 3 of 4

The stream redirects between https and http

1Check

ExoPlayer follows redirects, but not cross-protocol ones (https to http or the reverse) in its default configuration. Read the Location header chain.

curl -sIL "https://example.com/stream/index.m3u8" | grep -i -E "^HTTP|^location"

2Fix

Change the server so the redirect stays on one protocol, or point the app at the final URL directly.

final controller = VideoPlayerController.networkUrl(
  Uri.parse('https://cdn.example.com/stream/index.m3u8'),
);

3Verify

curl shows no protocol change and the video starts.

curl -sIL "https://cdn.example.com/stream/index.m3u8" | grep -i -E "^HTTP|^location"

Confirmed by developer.android.com

Did this fix it?

Cause 4 of 4

An HLS stream is not recognised as HLS

1Check

ExoPlayer tries to play such a stream as a progressive file unless it can tell it is HLS. The video_player constructor has an Android-only formatHint to override format detection.

curl -sI "https://cdn.example.com/stream/live" | grep -i content-type

2Fix

Pass the format hint.

final controller = VideoPlayerController.networkUrl(
  Uri.parse('https://cdn.example.com/stream/live'),
  formatHint: VideoFormat.hls,
);

3Verify

The stream starts and the unrecognized-format line is gone from the log.

adb logcat | grep -i extractor

Confirmed by pub.dev

Did this fix it?

How do I stop it coming back?

  • Add the INTERNET permission when you add video_player.
  • Serve streams over https and keep redirects on one protocol.
  • Pass formatHint for HLS URLs without a .m3u8 ending.
  • Check new stream URLs with curl before blaming the player.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Mobile apps

Google Play says the app does not support 16 KB memory pages

check_elf_alignment.sh reports UNALIGNED for a library under lib/arm64-v8a

Google Play requires apps that target Android 15 or higher and ship native .so libraries to run on devices with 16 KB memory pages; from 1 February 2027 it will block updates that do not.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.