Repository navigation
Description
Describe the bug
On Android (Pixel 8a API 35 emulator and Honor MTN-NX1M physical device, Android 16, arm64-v8a), remote HTTPS URLs fail during VideoPlayerController.initialize() when fvp.registerWith() is enabled:
PlatformException(media open error, invalid or unsupported media, null, null)
The failure is in FFmpeg's TLS backend (mbedTLS). The message ASN no signer error to confirm failure corresponds to MBEDTLS_ERR_X509_CERT_VERIFY_FAILED — no trusted CA is available to verify the server certificate. FFmpeg's -188 is FFmpeg's wrapped TLS/I/O error, not mbedTLS's raw code.
The same URL plays on iOS Simulator with fvp, and on Android without fvp (ExoPlayer via official video_player).
Expected behavior
Remote HTTPS URLs should initialize and play on Android with fvp.registerWith(), as on iOS.
Log
Add
import 'package:logging/logging.dart';
import 'package:intl/intl.dart';add the following lines before registerWith()
Logger.root.level = Level.ALL;
final df = DateFormat("HH:mm:ss.SSS");
Logger.root.onRecord.listen((record) {
debugPrint(
'${record.loggerName}.${record.level.name}: ${df.format(record.time)}: ${record.message}',
wrapWidth: 0x7FFFFFFFFFFFFFFF);
});log
I/flutter: fvp.FINE: registerVideoPlayerPlatformsWith: null
I/flutter: fvp.FINE: player create(https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4)
I/flutter: mdk.INFO: 0.37.0 (git 6a53973) - Multimedia Development Kit
I/flutter: mdk.FINE: fvp plugin version: 0.37.3
I/flutter: mdk.FINE: Trying MediaIO FFmpeg
I/flutter: mdk.FINE: open url: https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4
I/flutter: mdk.FINE: [FFmpeg:tls] -188 -> ASN no signer error to confirm failure
I/flutter: mdk.FINE: Error avrt::avio_open2(...) @167 AVFormatIO.cpp: (0xfffffffb) I/O error
I/flutter: mdk.WARNING: url open error. elapsed: 124ms
I/flutter: mdk.WARNING: Failed to create io for url. io: 0x..., open: 0
I/flutter: mdk.FINE: [FFmpeg:tls] -188 -> ASN no signer error to confirm failure
I/flutter: mdk.FINE: Error avformat_open_input(...) @393 FFmpegPacketIO.cpp: (0xfffffffb) I/O error
I/flutter: fvp.FINE: onMediaStatus: MediaStatus(+loading) => MediaStatus(+invalid)
I/flutter: mdk.WARNING: reader open error
E/flutter: Unhandled Exception: PlatformException(media open error, invalid or unsupported media, null, null)
On the physical device (Honor MTN-NX1M), the same PlatformException appears in the UI. adb logcat was unavailable on that device (Honor HKS log encryption); emulator log above is representative.
Additional per-experiment logs available on request.
Environment
fvp: 0.37.3
libmdk: 0.37.0 (git 6a53973)
video_player: 2.11.1
logging: 1.3.0
intl: 0.19.0
Flutter 3.44.4 • channel stable
Framework • revision ad70ec4617 (2026-06-24)
Engine • revision a10d8ac38d
Tools • Dart 3.12.2 • DevTools 2.57.0
Host OS: macOS 26.2 (darwin-arm64)
Devices tested
| Device | API / OS | ABI | fvp | Result (bee.mp4) |
|---|---|---|---|---|
| sdk gphone64_arm64 emulator | Android 15 / API 35 | arm64-v8a | yes | FAIL |
Honor MTN-NX1M (MTN_NX1M) |
Android 16 / API 36 | arm64-v8a | yes | FAIL — same PlatformException on screen |
| iPhone 11 Simulator | iOS 17.5 | arm64 | yes | PASS |
URLs tested (Android + fvp, default registerWith())
| URL | Format | Result |
|---|---|---|
https://flutter.github.io/.../bee.mp4 |
H.264 MP4 | FAIL |
https://cdn.theoplayer.com/.../index.m3u8 |
HLS | FAIL |
https://ks3-cn-beijing.ksyun.com/.../jinjie_265.mp4 |
HEVC MP4 | FAIL |
https://commondatastorage.googleapis.com/.../BigBuckBunny.mp4 |
H.264 MP4 | FAIL |
All fail with the same TLS error. Detailed cross-environment matrix used bee.mp4.
Minimal reproduction
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:logging/logging.dart';
import 'package:video_player/video_player.dart';
import 'package:fvp/fvp.dart' as fvp;
void main() {
Logger.root.level = Level.ALL;
final df = DateFormat('HH:mm:ss.SSS');
Logger.root.onRecord.listen((record) {
debugPrint(
'${record.loggerName}.${record.level.name}: ${df.format(record.time)}: ${record.message}',
wrapWidth: 0x7FFFFFFFFFFFFFFF,
);
});
fvp.registerWith();
runApp(const MaterialApp(home: Scaffold(body: Center(child: _Video()))));
}
class _Video extends StatefulWidget {
const _Video();
@override
State<_Video> createState() => _S();
}
class _S extends State<_Video> {
late final VideoPlayerController c;
@override
void initState() {
super.initState();
c = VideoPlayerController.networkUrl(Uri.parse(
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4',
));
c.initialize().then((_) { c.play(); setState(() {}); });
}
@override
void dispose() { c.dispose(); super.dispose(); }
@override
Widget build(BuildContext context) => c.value.isInitialized
? AspectRatio(aspectRatio: c.value.aspectRatio, child: VideoPlayer(c))
: const CircularProgressIndicator();
}pubspec.yaml dependencies:
dependencies:
flutter:
sdk: flutter
fvp: ^0.37.3
video_player: ^2.9.0
logging: ^1.2.0
intl: ^0.19.0Diagnosis
FFmpeg's mbedTLS backend on Android has no CA trust anchors. With default options, Trying MediaIO FFmpeg fails at HTTPS open before demux.
Diagnostic only: avformat.tls_verify: '0' allows playback — mdk then falls back to PacketIO after the initial FFmpeg TLS failure (prepared → buffered → first frame → EOF). This confirms the CA/TLS diagnosis but is not a production fix.
Emulator clock verified correct (Jul 4 2026); not clock skew.
TLS / IO workaround experiments (bee.mp4, Android emulator)
| Workaround | tls_verify |
Result |
|---|---|---|
player.demuxer: PacketIO |
default (1) |
FAIL — still tries FFmpeg first |
global.MediaIO.priority: PacketIO,FFmpeg |
default | FAIL |
player.avformat.avio: 0 |
default | FAIL — listed under unused avformat options |
player.io: PacketIO |
default | FAIL |
global.demuxer.io: 2 |
default | FAIL |
global.demuxer.io: 0 |
default | FAIL |
avformat.ca_file + Mozilla cacert.pem |
1 |
FAIL — ca_file listed under unused avformat options; same TLS error |
global.io.avio: 0 |
default | FAIL |
avformat.tls_verify: 0 |
0 |
PASS (diagnostic only; disables cert validation) |
avformat.protocol_whitelist / extension_picky |
default | FAIL |
Without fvp.registerWith() |
n/a | PASS (ExoPlayer) |
No production-safe workaround found. PacketIO works only when TLS verification is disabled (fallback path).
Example log line when ca_file is set:
mdk.FINE: unused avformat options: ... ca_file=/data/.../cacert.pem ... tls_verify=1 ...
What I already tried
- Android without fvp → ExoPlayer plays successfully
video.decoders: ['FFmpeg']→ same TLS failure- Protocol whitelist / extension_picky / combined Android config → same TLS failure
flutter clean+ rebuild → no change- Native libs in debug APK:
libfvp.so,libmdk.so,libffmpeg.sopresent forarm64-v8a - minSdk 21, no abiFilters, INTERNET in debug manifest
Related issues
- error:invalid or unsupported media #360 — same symptom; lacks logs
- Video Player Init Faild #96 — same PlatformException on Android
- playing a m3u8 file throws error #15 / Can't play video that requires headers #225 — protocol whitelist; different root cause (TLS/CA, not protocol whitelist)
Possible directions (deferring to maintainer expertise)
The root cause appears to be that FFmpeg's mbedTLS on Android has no trust anchors. A few directions that would resolve this from a user perspective — any one would work:
- Making Android HTTPS use platform IO / system trust store by default (would match iOS behavior)
- Bundling a CA cert file with the Android native library
- Fixing
avformat.ca_fileso users can supply their own bundle (currently listed underunused avformat optionswith no effect)
Happy to test any patch or preview build. There may be lower-level approaches I'm not aware of.
Activity
wang-bin commentedon Jul 6, 2026
ffmpeg turn on tls_verify recently, but my build does not load certs, I will enable it ASAP. what about
wang-bin commentedon Jul 6, 2026
now ffmpeg loads system ca, the error should be gone. try to upgrade the dependencies