For example, when the user starts watching the stream, I will initialize the player and that starts playing from the latest position in the live stream. If the user then pauses the video they will be x seconds behind the latest stream position. I want to add functionality to allow them to seek directly the latest live position.
My current approach is to simply reinitialize the stream...
_videoPlayerController1 = VideoPlayerController.network('theUrl/index.m3u8');
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController1,
autoPlay: true,
isLive: true,
autoInitialize: true,
);
However, as the two mentioned libraries heavily emphasize the need to call dispose() when finished with them I'm worried about creating memory leaks here. Is this approach okay?
I did try calling dispose() on them both before calling the above code...
_videoPlayerController1.dispose();
_chewieController.dispose();
Although that led to the following error 'A VideoPlayerController was used after being disposed. Once you have called dispose() on a VideoPlayerController, it can no longer be used.'
Does my approach lead to memory leaks and is there a better way to seek the latest live stream position?