Flutter video_player fails on Android with ExoPlaybackException: Source error
PlatformException(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.
Fix it fast
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"2Match what you see, then jump to its fix
- 1
Every network URL fails, including https ones, while asset videos playThe INTERNET permission is missing from the manifestFix - 2
The log mentions Cleartext HTTP traffic not permittedThe URL uses http and cleartext traffic is blockedFix - 3
The server answers 301 or 302 and the final location uses the other protocolThe stream redirects between https and httpFix - 4
The log shows UnrecognizedInputFormatException, often for a URL that does not end in .m3u8An HLS stream is not recognised as HLSFix
- 1
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 permittedUnrecognizedInputFormatException: 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.xml2Fix
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 runConfirmed by pub.dev
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.xml2Fix
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 runConfirmed by developer.android.com
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
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-type2Fix
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 extractorConfirmed by pub.dev
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:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- Dispatch ProA real-time logistics platform: Flutter apps, Spring Boot services and a Kafka event pipeline on AWS.
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 fixMobile apps
Gradle cannot find com.google.firebase:firebase-analytics-ktx
Required by: project :app
Firebase moved the Kotlin extensions into the main modules and stopped releasing the -ktx modules in July 2025.
2 causes, each with a fixMobile apps
Gradle cannot create LibraryVariantBuilderImpl in a Flutter Android build
Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl
This error appears when the Android Gradle plugin (AGP) cannot run in the Gradle or IDE you use.
3 causes, each with a fixMobile apps
Flutter release build cannot open the keystore: HmacPBESHA256 not available
Algorithm HmacPBESHA256 not available
The keystore is a PKCS12 file protected by a newer algorithm than the Java that is reading it understands.
3 causes, each with a fixMobile apps
Android install error: the package conflicts with an existing package of the same name
The package conflicts with an existing package by the same name
Android allows only one app per application ID, and an update must be signed with the same certificate as the installed version.
3 causes, each with a fixMobile apps
Android resource linking fails with resource android:attr/lStar not found
error: failed linking references.
The lStar attribute exists only from Android API 31.
2 causes, each with a fix