New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The video_player plugin fails to play videos after playing successfully 10-15 times #24565
Comments
I have had a similar problem, this is my first flutter App so I am new to this.. And would like example of how to use your CustomVideoPlayer in a demo app. Otherwise I nut it out. |
Hello all, I have done more experimenting with this issue. I can confirm this issue happens about 15-20 as indicated. My test platform is a Mi Android TV box. (The emulator on my Macbook seems far more robust and can go langer then the target hardware I am using.) In todays tests, I changed my app to place the Video Player in a widget. then that widget, between plays I dispose, and it disposes of the Video Player instance within it. In an attempt to force clean up of the player into a state as if it was the fist time you use it and it all works fine. This has not made a difference. The problem still occurs. I am greatly disappointed as I find flutter extremely fast and easy to make apps for digital signs and have some great ideas for writing apps for my needs. But without a reliable video player.... disappointed. Video is a very popular feature so I am hoping this gets some attention sooner than later. Notes,
|
@tvolkert following on from #24402 resulting in 0.11.13, re-compiling with that version has not fixed my issue as seen on the Mi BOX Android TV. It still locks up the player after quite a number of video file playbacks. I must admit, however, under my Mac emulator, it seems to be playing OK. I just loaded my test App onto an older Android Box that had the video corruption. The #24402 fix definitely worked as it now works on this older android box, but it also stops after a small number of restarts just like the MiBOX. This would indicate its not likely the MiBOX as its exhibiting the same behaviour on this older android unit. But I must admit, I find it strange the Emulator is running wthout issues currently, and its been running for about 40mins. the others are stuffed in about 5-10 mins. The behaviour I have is that the timer keeps going, but the 7 seconds of attempting to play the video.. nothing but a BLACK background. 7 seconds up, container disappears for a 1 second period and it tries again .. just black backgrounds and no playing video. I will also mention I am using 'flutter build apk --release' version of the test android boxes. Should I attempt a debug build? |
@Abgaryan It looks like you have a memory leak. Can you dispose the controller when your CustomVideoPlayer gets disposed? @override
void dispose() {
super.dispose();
controller.dispose();
} That's probably the root of your leak. |
No I specifically made sure I did that as I expected it could have been that.. |
You'd also need to dispose the |
/cc @cbracken |
One technique that can help for debugging this is instrumenting the lifecycle of the video player plugin. Obtain the plugin source from https://github.com/flutter/plugins. In the app's video_player:
path: /path/to/plugins/packages/video_player Then, in |
Ok, just to follow up on this.. @override
void dispose() {
super.dispose();
_controller.dispose();
debugPrint('CmVideoPlayer - dispose()');
} Note: In the parent widget I use a variable that periodically makes the video widget and removes it.. causing a dispose when it gets removed. In terms of @jason-simmons suggestion. Good suggestion, it was were I was looking at going next and was going to ask for some direction.
|
Just another update. |
For the compilation errors, try modifying your app's compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
} |
Hi those watching. In the mean time, I have set up a permanent windows machines running the test emulator 24h while this is still an open issue. Also to confirm my tests over the weekend. (The test app did die a few times but the errors looked more to do with how my Macbook wakes up after being left idle) |
Ok, Any suggestions on how we can solve this problem would be appreciated. Considering it works on the emulator and not on any real Android devices. it looks like a really deep difficult issue only the key media player developers may have any idea about. There is no reason why this should work.. If I can help, considering I am no java developer, anything else hit me up. I will continue with my flutter app and develop the POSTER (Images only) side for now. But hell, I was hoping to allow it to also play MP4 trailers. My flutter apk will be on admin.clubmovie.com.au/media, the APK downloads towards the bottom. I must admit, considering emulator works and devices don't, I am also crossing my fingers simply showing a poster every 7 seconds then loading a new one, constantly will not also die on a real android device.!! (Using Flutter) Would also like to hear from anyone that has successfully made an AndroidApp, in java/kotlin over flutter that can successfully play mp4s day in and day out without dieing. Want to know if it is even possible.. (DO I need to learn Java/kotlin to get such an app working) |
@jason-simmons I am chasing down the latest video_player on github (v0.8.0) as it has some fixes that may affect this issue. I added, video_player:
git:
url: git://github.com/flutter/plugins.git
path: packages/video_player so my pubspec.yaml This came up with an error suggesting I add android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
} to build.gradle Resulting in an error of..
This is where I get lost and would appreciate input. |
Update info. I have connected a MI Box m3 to windows machine and run the app through AndroidStudio resulting in the following crash info
|
@jamiegau any chance you can try symbolicating that trace? https://github.com/flutter/flutter/wiki/Crashes If you know the framework revision when that happened, we can symbolicate it as well |
This crash was caused by an exception thrown when
|
On this issue...
|
Guys, if it will help, I can zip up my (test version) app and send it to you. It will auto download a number of test files, play them in a loop (1 sec between files then plays 7 seconds of file and disposes and loops), takes about 10 min for the error to appear. The app simply continues with the error seen above being output. An observation is that when it starts erroring, it happens on one, then another, then all items it tries to play result in the error. This would indicate memory allocation again and as it get worse, it has more problems until it completely fails. The initial error with the ultimate crash as listed before the continuous error above may have been an overnight crash, forget exact details. I am guessing it may have gone all the way till it resulted in the total crash in the previous dump example. But ultimately we need to concentrate on why, after a number of plays, the continuous memory error occurs. I would also like to mention. I would consider this a ShowStopper bug for those wishing to use Flutter for any type of video application.. I suppose it is unlikely flutter apps will ever attempt to play videos 20-30 times before the app is killed and restarted, but I can see it being a edge case even for some mobile apps. |
Hello I have this also when I repeat call of _controller.initialize(); . I repeated call _controller.initialize(); to reload video after finish. without this I can't repeat video after finish. but When I call multiple time _controller.initialize(); I have this error :
any solution ? thank you |
Every time you call "initialize ()" you create a new video instance, this can result in unnecessary resource usage. I suggest that instead of using initialize to play the video again, you just change the playback position to the initial time of the video, so you don't have to be initializing all the time. Detects that you have reached the end: if (_controller.value.position >= _controller.value.duration ....) |
Hello I tried but I am forced to use .initialize() to relaunch the vidéo.
i'm forced to use
if (_controller.value.position >= _controller.value.duration ){
_controller.initialize();
}
It's ok few time but after I have the error
if (_controller.value.position >= _controller.value.duration ){
_controller.play();
}
It doesn't work
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le jeu. 1 août 2019 à 21:26, Leonardo Neto <notifications@github.com> a
écrit :
… @nitneuq33 <https://github.com/nitneuq33>
433/5000
Toda vez que você chama "initialize()" você cria uma nova instância de
vídeo, isso pode resultar em um uso desnecessário de recursos.
Acoselho que ao invés de usar initialize para executar o vídeo novament,
você apenas altere a posição da reprodução para o tempo inicial do vídeo,
assim você não precisa ficar inicializando toda hora.
Detecta que chegou no final:
if (_controller.value.position >= _controller.value.duration ....)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#24565?email_source=notifications&email_token=AGSYLSZV4UJB3YODVGZBGULQCM2G3A5CNFSM4GFMLRP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3LUGAQ#issuecomment-517423874>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGSYLS3B5B6MJVKX3ZOCWCDQCM2G3ANCNFSM4GFMLRPQ>
.
|
sorry I havn't a great trad of Portuguese^^ I understand your solution but don't know how to apply this ... have you a little example ? thank you |
I tried this
but position can"t be use as a setter because its final ... |
Hello good day, Try it:
|
ow thank you it's work !!
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le ven. 2 août 2019 à 16:31, Leonardo Neto <notifications@github.com> a
écrit :
… Hello good day,
Try it:
_controller.seekTo(Duration.zero);
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#24565?email_source=notifications&email_token=AGSYLS6ZJXUO3Z44IDR2HUDQCRALTA5CNFSM4GFMLRP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3N47BQ#issuecomment-517721990>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGSYLSZEOI7S6HMZM5DFWKDQCRALTANCNFSM4GFMLRPQ>
.
|
I have an other problem with initialize, Each days I can record video, and
after I can see my videos historique in increase or decrease days with the
help of button. When I change date I catch the path of the video and need
to initialize to reload the new video. Problem, after some date change I
have the ressource issue. I don't know how to reload an other video without
initialize and make ressource issue... thank you for the help
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le ven. 2 août 2019 à 17:36, quentin guichot <guichotquentin@gmail.com> a
écrit :
… ow thank you it's work !!
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Garanti
sans virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-890614965646860603_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le ven. 2 août 2019 à 16:31, Leonardo Neto ***@***.***> a
écrit :
> Hello good day,
>
> Try it:
>
> _controller.seekTo(Duration.zero);
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#24565?email_source=notifications&email_token=AGSYLS6ZJXUO3Z44IDR2HUDQCRALTA5CNFSM4GFMLRP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3N47BQ#issuecomment-517721990>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AGSYLSZEOI7S6HMZM5DFWKDQCRALTANCNFSM4GFMLRPQ>
> .
>
|
I tried to dispose and initialize but not working
_controller.dispose();
_controller.initialize();
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le ven. 2 août 2019 à 17:44, quentin guichot <guichotquentin@gmail.com> a
écrit :
… I have an other problem with initialize, Each days I can record video, and
after I can see my videos historique in increase or decrease days with the
help of button. When I change date I catch the path of the video and need
to initialize to reload the new video. Problem, after some date change I
have the ressource issue. I don't know how to reload an other video without
initialize and make ressource issue... thank you for the help
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Garanti
sans virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#m_-754405940001299814_m_-5637162139559434085_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le ven. 2 août 2019 à 17:36, quentin guichot ***@***.***> a
écrit :
> ow thank you it's work !!
>
>
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Garanti
> sans virus. www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
> <#m_-754405940001299814_m_-5637162139559434085_m_-890614965646860603_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> Le ven. 2 août 2019 à 16:31, Leonardo Neto ***@***.***> a
> écrit :
>
>> Hello good day,
>>
>> Try it:
>>
>> _controller.seekTo(Duration.zero);
>>
>> —
>> You are receiving this because you were mentioned.
>> Reply to this email directly, view it on GitHub
>> <#24565?email_source=notifications&email_token=AGSYLS6ZJXUO3Z44IDR2HUDQCRALTA5CNFSM4GFMLRP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3N47BQ#issuecomment-517721990>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/AGSYLSZEOI7S6HMZM5DFWKDQCRALTANCNFSM4GFMLRPQ>
>> .
>>
>
|
Really this plugin has problems when you want to reuse the same component and just change the datasource ... You can follow the beginning of this topic where I explain my solution to this question. Repository: https://github.com/leonetosoft/flutter_video_player Do not use: The app will crash very soon if you do this. |
Thank you ! I have add your repo in the pubspec and try to add nextvideo()
but I have some trouble to find the good write, for video I have"
undifined name" and for : I have " expected to find )".
_controller.nextVideo(video.file:${extDir.path}/Movies/$daysfromnow_modify.mp4);
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Garanti
sans virus. www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Le sam. 3 août 2019 à 05:00, Leonardo Neto <notifications@github.com> a
écrit :
… Really this plugin has problems when you want to reuse the same component
and just change the datasource ...
You can follow the beginning of this topic where I explain my solution to
this question.
Repository: https://github.com/leonetosoft/flutter_video_player
Do not use:
_controller.dispose();
_controller.initialize();
The app will crash very soon if you do this.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#24565?email_source=notifications&email_token=AGSYLSZS3K2ZXCMY6ZNDXA3QCTYGJA5CNFSM4GFMLRP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3PFW3Q#issuecomment-517888878>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGSYLSZF4TLLFJKQCVRT4R3QCTYGJANCNFSM4GFMLRPQ>
.
|
Hi all, I see the discussion being more recently pointing at the issue of @leonetosoft , @nitneuq33 |
I can test ... Actually I solved this problem by creating my video_player branch, in this branch I created an option to change the video source without having to destroy the component. You mean they can now destroy without it locking up? |
I upload last version but have same error, but it's with my old code. I tried to start a new projet with the example in github but I don't found how to launch a file from a path, I did this with my old code but I see only two solution NetworkPlayerLifeCycle or AssetsPlayerLifeCycle, I have a file in Movie/myfile.mp4 but I don't know how to call to test |
@iapicca |
Ok, I am looking at nightly restart-OS to make it reliable, but I am a ways of before I get back into making the player front end. Still developing the backend to feature complete. The question I have, should I expect this to play forever indefinitely. I suppose I should. But is this considered "good enough"? 2 days without issue.. Hell, it could be another widget I am using that has the memory leak. I could run it though the emulator again and capture the crash output. Tho for some reason take 3-4 days to crash when in emulator over a kogan Android TV set. |
Hi all, if you disagree please write in the comments If you are experiencing different issues, Thank you all for your contribution |
I still have this problem, I don't understand why this issue was closed? |
From my understanding the original developer from Google, looked into this. Stated it was rectified under new revisions that effected the java side of the code.. |
I created a pull request so that I added the implementation of nextVideo for Android. |
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 |
Steps to Reproduce
Video player fails to load (both in Android and iOS) after it loads approximately 10-15 times successfully.I assume VideoPlayer instance in a native level gets corrupted.
Sequence of events:
My custom VideoPlayer:
Logs
iOS:
Android :
The text was updated successfully, but these errors were encountered: