Closed cavedweller closed 3 years ago
@cavedweller
can you run flutter upgrade -f
if the issue persists
please provide a minimal reproducible code sample that does not rely on 3rd party packages (like photo_manager)
together with the output of flutter run --release -v
and your updated flutter doctor -v
New Doctor
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.18362.356], locale en-ZA) • Flutter version 1.22.5 at C:\Users\ricca\flutter • Framework revision 7891006299 (10 days ago), 2020-12-10 11:54:40 -0800 • Engine revision ae90085a84 • Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at C:\Users\ricca\AppData\Local\Android\sdk • Platform android-29, build-tools 29.0.2 • Java binary at: C:\Program Files\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) • All Android licenses accepted.
[!] Android Studio (version 3.5) • Android Studio at C:\Program Files\Android Studio X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.52.0) • VS Code at C:\Users\ricca\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.17.0
[√] Connected device (1 available) • SM G950F (mobile) • ce081718e4a08f1b04 • android-arm64 • Android 9 (API 28)
Unable to get rid of third party package The problem is that the package actually gets the media from the device and stores it in a readable list which is displayed in the gridview, therefore i can not really get rid of the third party package as the whole project is based around it.
this is the package link: https://pub.dev/packages/photo_manager
Hi @cavedweller Can you please provide the logs of the crash? Thank you
I was able to reproduce the issue.
The above example is not properly disposing the previous VideoPlayerController before creating a new one, causing it to leak.
Adding
final lastVideoController = _videoController;
if (lastVideoController != null) {
WidgetsBinding.instance.addPostFrameCallback((_) {
lastVideoController.dispose();
});
}
above _videoController = VideoPlayerController.file(file);
fixes it for me
I don't believe this is an issue in Flutter or the video_player plugin, let me know if the issue persists after disposing the video controller and we can re-open it
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
Issue
If I click on 15 or more videos in quick succession the video player crashes and shows a black screen. Im not sure if its due to the system over working or possibly because i am not pausing or disposing of the video correctly.
Flutter Doctor [√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18362.356], locale en-ZA) • Flutter version 1.22.4 at C:\Users\ricca\flutter • Framework revision 1aafb3a8b9 (5 weeks ago), 2020-11-13 09:59:28 -0800 • Engine revision 2c956a31c0 • Dart version 2.10.4
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at C:\Users\ricca\AppData\Local\Android\sdk • Platform android-29, build-tools 29.0.2 • Java binary at: C:\Program Files\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) • All Android licenses accepted.
[!] Android Studio (version 3.5) • Android Studio at C:\Program Files\Android Studio X Flutter plugin not installed; this adds Flutter specific functionality. X Dart plugin not installed; this adds Dart specific functionality. • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] VS Code (version 1.52.0) • VS Code at C:\Users\ricca\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.17.0
[√] Connected device (1 available) • SM G950F (mobile) • ce081718e4a08f1b04 • android-arm64 • Android 9 (API 28)
Code
``` import 'package:flutter/material.dart'; import 'package:photo_manager/photo_manager.dart'; import 'dart:io'; import 'package:video_player/video_player.dart'; class SampleCode extends StatefulWidget { SampleCode({Key key}) : super(key: key); @override _SampleCodeState createState() => _SampleCodeState(); } class _SampleCodeState extends StateVideo is attached below however the video recorder stops when the error is thrown for some reason, I have also attached a screenshot after the error. The weird thing is that the audio is still playing on a loop while the screen is blacked out so it seems that the video is crashinig and not the audio.
https://user-images.githubusercontent.com/70595829/102686343-af5c8f00-41ef-11eb-8a8b-cda01aa7f803.mp4
.