-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Steps to reproduce
flutter: "3.29.3"
video_player: 2.9.5
- OpenFlutter project containing the looping video widget (using video_player and VideoPlayerController.asset).
- Ensure the app’s main screen displays the VideoWidget, initialized with a short asset video set to loop indefinitely.
- Connect a real Android device (or launch an emulator) and run the app in profile or release mode:
- Leave the app running on the video-playing screen continuously for an extended period (e.g. 72+ hours).
- Periodically check memory usage via: adb shell dumpsys meminfo {{PACKAGE_NAME}} | grep TOTAL or via Dev Tools
- Observe that the reported RAM usage climbs steadily (eventually reaching ~2 GB), rather than stabilizing.
Expected results
The video player should run indefinitely (e.g. for months or even a year) without any unbounded increase in RAM usage.
Memory consumption should stabilize shortly after startup (e.g. remain under ~200 MB on Android profile mode) and never grow continuously.
Actual results
When looping a short video via the official video_player plugin, RAM usage climbs steadily.
After ~72 hours of continuous playback, the process consumes up to ~2 GB of memory, eventually leading to out-of-memory crashes.
Code sample
Code sample
class VideoWidget extends StatefulWidget {
const VideoWidget({
super.key,
required this.videoAsset,
this.controller,
});
final String videoAsset;
final VideoPlayerController? controller;
@override
State<VideoWidget> createState() => _VideoWidgetState();
}
class _VideoWidgetState extends State<VideoWidget> with RouteVisibilityMixin {
late VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = widget.controller ?? VideoPlayerController.asset(widget.videoAsset);
_controller.setLooping(true);
_controller.initialize().then((_) => setState(() {}));
_controller.play();
}
@override
Future<void> dispose() async {
super.dispose();
await _controller.dispose();
}
@override
void onRouteVisibilityChanged(bool isRouteVisible) {
if (isRouteVisible && !_controller.value.isPlaying) {
_controller.play();
} else if (!isRouteVisible && _controller.value.isPlaying) {
_controller.pause();
}
}
@override
Widget build(BuildContext context) {
return FittedBox(
fit: BoxFit.cover,
child: SizedBox(
width: _controller.value.size.width,
height: _controller.value.size.height,
child: VideoPlayer(_controller),
),
);
}
}Screenshots or Video
No response
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.29.3, on macOS 15.5 24F74 darwin-arm64, locale pl-PL) [1 292ms]
• Flutter version 3.29.3 on channel stable at /Users/marcin/Library/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ea121f8859 (6 weeks ago), 2025-04-11 19:10:07 +0000
• Engine revision cf56914b32
• Dart version 3.7.2
• DevTools version 2.42.3
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1 867ms]
• Android SDK at /Users/marcin/Library/Android/sdk
• Platform android-35, build-tools 35.0.0
• ANDROID_HOME = /Users/marcin/Library/Android/sdk
• Java binary at: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [1 599ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16E140
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [11ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.3) [10ms]
• Android Studio at /Applications/Android Studio.app/Contents
• 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 21.0.6+-13368085-b895.109)
[✓] VS Code (version 1.99.3) [9ms]
• VS Code at /Users/marcin/Downloads/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available) [6,3s]
• macOS (desktop) • macos • darwin-arm64 • macOS 15.5 24F74 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.5 24F74 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 136.0.7103.114
[✓] Network resources [625ms]
• All expected network resources are available.
Metadata
Metadata
Assignees
Labels
r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version