'flutter video_player Not playing the video in release mode
i use video_palyer : ^2.1.0
the video playing normaly in debug mode but whene i run release apk the video not playing
UPDATE
the problem from flutter_facebook_auth
and flutter_facebook_login
whene i remove them the video work fine
is there any solution to keep both of them because i need both
video_player
and flutter_facebook_login
!
voila my flutter doctor :
[√] Flutter (Channel dev, 2.1.0-12.1.pre, on Microsoft Windows [Version 10.0.19042.867], locale en-US) • Flutter version 2.1.0-12.1.pre at C:\src\flutter • Framework revision 8264cb3e8a (3 weeks ago), 2021-03-10 12:37:57 -0800 • Engine revision 711ab3fda0 • Dart version 2.13.0 (build 2.13.0-116.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\DEVANDROID\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) • All Android licenses accepted.
[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.54.3) • VS Code at C:\Users\DEVANDROID\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.20.0
[√] Connected device (3 available) • EML L29 (mobile) • UBV7N18A12004906 • android-arm64 • Android 10 (API 29) • Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.114 • Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.63
• No issues found! Process finished with exit code 0
and voila my code exemple :
VideoPlayerController _controller;
double width;
double height;
bool startedPlaying = false;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.asset('assets/video/successEqo.mp4');
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
Future<bool> started() async {
_controller.setLooping(true);
_controller.setVolume(1);
await _controller.initialize();
await _controller.play();
startedPlaying = true;
return true;
}
@override
Widget build(BuildContext context) {
width = MediaQuery.of(context).size.width;
height = MediaQuery.of(context).size.height;
return Material(
color: Colors.transparent,
child: Container(
color: Colors.red,
child: FutureBuilder<bool>(
future: started(),
builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
if (snapshot.data == true) {
return AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
);
} else {
return Center(child: const Text('waiting for video to load'));
}
},
)
,
),
);
}
Solution 1:[1]
try running following command:
flutter build apk --release --split-per-abi
Solution 2:[2]
Maybe you need to add permissions to the AndroidManifest?
<uses-permission android:name="android.permission.INTERNET"/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rahul Agarwal |
Solution 2 | Umid Akbaraliyev |