tryInit method

dynamic tryInit(
  1. int index
)

Implementation

tryInit(int index) async {
  var oldVideoPlayerController = videoPlayerControllerList[index];
  if (oldVideoPlayerController.value.isInitialized) {
    oldVideoPlayerController.play();
    refresh();
    return;
  }
  VideoPlayerController videoPlayerControllerTmp =
      await videoControllerService.getControllerForVideo(
          videoList[index], isCaching);
  videoPlayerControllerList[index] = videoPlayerControllerTmp;
  await oldVideoPlayerController.dispose();
  refreshView();
  cacheVideo(index);
  await videoPlayerControllerTmp
      .initialize()
      .catchError((e) {})
      .then((value) {
    videoPlayerControllerTmp.play();
    refresh();
  });
}