I'm using provider
with video_player
to manage the state.
VideoProvider has:
videoPlayerController = VideoPlayerController.network(...);
which I frequently change when the user switches to a new video (same screen). If I directly assign a new VideoPlayerController.network(...)
into the videoPlayerController
, the old video will still play and you can hear the sound. The workaround is to videoPlayerController.pause()
then assign a new VideoPlayerCOntroller.network
afterwards.
Is the previous Video being disposed by GC? Are there any performance issues with this? I want to get rid of the previous video and the resources used before switching to a new one. I can't videoPlayerController.dispose()
before switching because it causes an error.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…