loadPresentation method

Future loadPresentation({
  1. String? path,
  2. int quality = SLIDE_HIGHQ,
  3. bool doubleLoad = true,
})

Implementation

Future loadPresentation({
  String? path,
  int quality = SLIDE_HIGHQ,
  bool doubleLoad = true,
}) async {
  if (path == null) return getCurrentPresentation(quality: quality, doubleLoad: doubleLoad);

  // we set this here, because ProPresenter 6 doesn't return
  // the presentationPath if it was in the request.
  // but we need to remember it
  requestedPresentationPath = path;

  var pro6formattedPath = path.replaceAll('/', r'\/');
  var pathToSend = parent.settings.is7 ? path : pro6formattedPath;

  if (doubleLoad && quality > SLIDE_LOWQ) {
    await act('presentationRequest',
        args: {
          'presentationPath': pathToSend,
          'presentationSlideQuality': SLIDE_LOWQ,
        },
        responseAction: 'presentationCurrent');

    // we have to wait this one out because of the need to
    // clear out 'requestedPresentationPath' below
    await act('presentationRequest',
        args: {
          'presentationPath': pathToSend,
          'presentationSlideQuality': quality,
        },
        responseAction: 'presentationCurrent');
  } else {
    await act('presentationRequest',
        args: {
          'presentationPath': pathToSend,
          'presentationSlideQuality': quality,
        },
        responseAction: 'presentationCurrent');
  }

  // we are done with this request, so we clear out the variable
  requestedPresentationPath = null;
  return;
}