setDataSource method

Future<void> setDataSource(
  1. String dataSource, {
  2. String? package,
  3. bool isLooping = false,
  4. bool autoPlay = true,
  5. bool? mixWithOthers,
  6. Future<ClosedCaptionFile>? closedCaptionFile,
  7. Widget? prepare,
  8. Alignment? alignment,
  9. BoxFit? fit,
})

Implementation

Future<void> setDataSource(String dataSource,
    {String? package,
    bool isLooping = false,
    bool autoPlay = true,
    bool? mixWithOthers,
    Future<ClosedCaptionFile>? closedCaptionFile,
    Widget? prepare,
    Alignment? alignment,
    BoxFit? fit}) async {
  if (_isRelease == true) {
    BLLogger.error("videoPlayer has been release");
    throw FlutterError(
        " release() has been performed ,please initialize again ");
  }

  this.isLooping = isLooping;
  this.autoPlay = autoPlay;
  this.package = package;
  this.alignment = alignment;
  this.fit = fit;
  this.prepare = prepare;

  await _innerReset();

  _updatePlayerState(BlVideoPlayerState.prepareInitialized);

  _videoPlayerController = _initVideoController(
      dataSource, mixWithOthers, package, closedCaptionFile);

  _initialize();

  BLLogger.info("parameters:\n"
      "[package = $package] \n"
      "[isLooping = $isLooping] \n"
      "[autoPlay = $autoPlay] \n"
      "[alignment = $alignment] \n"
      "[fit = $fit]");
}