VideoPlayerController / ChewieController called on Dispose ()
Closed this issue · 12 comments
Hi there!
FluTube did a really good job where other plugins fails to do but I am having a strange issue and that is when ever I tries to change video URL Programmatically It shows error "VideoPlayer Controller called disposed".
Note: Error Disappears when I call setState on onVideoStart.
But this red error screen till video is loading is really annoying!
I will take a look on this. Thanks!
I will take a look on this. Thanks!
I fix it by modifying the source of FluTube!
Normally Example work perfectly but when we fetch youtube links from API then this error appears.
Moreover, sometimes this error got triggered due to Problem in VideoPlayer library so I have to write more code in FLuTube to handle these exceptions!
I think i'm not fully understanding you.
Which API are you talking about? This plugin does not use any APIs.
Also, what code did you add/modify to fix this problem?
If you solved this issue yourself and you think your fix could help others, you can make a pull request and it will be welcome.
I think i'm not fully understanding you.
Which API are you talking about? This plugin does not use any APIs.Also, what code did you add/modify to fix this problem?
If you solved this issue yourself and you think your fix could help others, you can make a pull request and it will be welcome.
The problem is in videoPlayerController so in onWidgetUpdate you are disposing videoController and chewieController. so I just added:
if(videoPlayerController !=null || chewieController !=null)
{
videoPlayerController .dispose();
chewieController .dispose();
}
Moreover there are more issues in VideoPlayer library that is used by chewieController so to handle this add this code.
videoController.addListener(() {
if (videoController.value.hasError) {
//handle by yourself
}
});
OR
videoController.addListener(() {
if (videoController.value.hasError) widget.onVideoError();
//let User to handle by creating onVideoError Callback
});
Sometimes performing these fixes also through Red Screen so handle this:
chewieController.addListener(() {
if (chewieController.videoPlayerController.value.hasError)
widget.onVideoError();
});
I hope you get it!
Thanks for your contribution!
You could send a pull request to add those changes as i don't have much time to do it. I will try thought.
I like the idea of letting the user handle errors via a callback!
Hello,
In the last commit i tried to apply what you said but i think it is not working.
Could you please review the changes and tell me what is wrong? Or better just send a pull request? I don't have time right now to dig on this issue, so your help will be appreciated.
Thank you
Yeah, that's correct I review it and that's the same way I am doing!
Youtube does not allow to access copyright videos so as for your permission can I do changes in your plugin so it can fetch those videos and play in player!
So did your issue get fixed?
Did you try the example app? I added a button to change video url but it is showing red screen when video gets changed, and also the onVideoError callback doesn't seem to be working for me.
Sure you can!
Roll back your commit as Error is in videoPlayer controller, and will be fixed soon according to them.
I have reviewed the example code, unfortunately, onVideoError is not working there. You should do roll back as it is not working.
Rollback done. Thanks!