Open nichtverstehen opened 6 years ago
Hi @nichtverstehen Given the mentioned PR is merged given your last message I feel safe to close this issue, if you disagree please write in the comments and I will reopen it. Thank you
The PR comment says:
This is a workaround for widgets not receiving dispose signals when FlutterView is destroyed (flutter/flutter#19358). flutter/flutter#20989 tracks ensuring that resources are released.
So the underlying issue is not fixed. Please keep this open.
Pls fix this, its creating huge problems
I'm here with the same problem @FlutterIssues
we got a workaround here, thinks its a standard way of doing this https://github.com/flutter/flutter/issues/61309
This is related to https://github.com/flutter/flutter/issues/19206 and https://github.com/flutter/flutter/issues/19358.
VideoPlayer
plugin on Android allocates a platformMediaPlayer
object for eachVideoPlayer
plugin in the widget tree.MediaPlayer
objects are destroyed when corresponding Flutter widgets go away. But if a wholeFlutterView
is destroyed,dispose
methods don't run, soMediaPlayer
instances are not released. This leads to leaks and also crashes (since the player continues to provide frames for non-existent surfaces; internal bug: b/112692333).IMO,
VideoPlayer
should rely on normal disposing for the final cleanup and just assert that by the time the view is destroyed all resources are released. This would rely on widgets disposal methods to be called, which is tracked in https://github.com/flutter/flutter/issues/19358.As a workaround,
VideoPlayer
should subscribe with aonViewDestroyListener
and explicitly release all resources when the ownerFlutterView
goes away.