releaseVideo method

Future<void> releaseVideo()

Drops a hold on videoController; the last one disposes it, so the looping video and its audio stop once no screen shows the entry, and the next retainVideo loads a fresh player.

Implementation

Future<void> releaseVideo() async {
  if (--_videoHolds > 0) return;
  final ctrl = videoController;
  if (ctrl == null) return;
  videoController = null;
  _videoInitStarted = false;
  notifyListeners();
  await ctrl.dispose();
}