initVideoUploader function

Future<BDVideoUploader> initVideoUploader(
  1. VideoUploaderOptions options
)

Implementation

Future<BDVideoUploader> initVideoUploader(VideoUploaderOptions options) async {
  if (!Platform.isAndroid && !Platform.isIOS) {
    throw UnsupportedError('Not Support Platform ${Platform.operatingSystem}');
  }

  final uploader = BDVideoUploader();
  uploader.initParams(options);
  if (options.region != null) {
    await uploader.setRegion(options.region!);
  }
  if (options.host != null) {
    await uploader.setHost(options.host!);
  }

  if (options.serverParameter != null) {
    await uploader.setServerParameter(options.serverParameter!);
  }
  if (options.fileType != null) {
    await uploader.setFileType(options.fileType!);
  }
  if (options.traceId != null) {
    await uploader.setTraceID(options.traceId!);
  }
  if (options.fileName != null) {
    await uploader.setFileName(options.fileName!);
  }

  if (options.poster != null) {
    await uploader.setPoster(options.poster!);
  }
  if (options.sliceSize != null) {
    await uploader.setSliceSize(options.sliceSize!);
  }

  if (options.socketNum != null) {
    await uploader.setSocketNum(options.socketNum!);
  }

  if (options.sliceRetryCount != null) {
    await uploader.setSliceRetryCount(options.sliceRetryCount!);
  }

  if (options.fileRetryCount != null) {
    await uploader.setFileRetryCount(options.fileRetryCount!);
  }

  if (options.tranTimeout != null) {
    await uploader.setTranTimeout(options.tranTimeout!);
  }

  if (options.filePrefix != null) {
    await uploader.setFilePrefix(options.filePrefix!);
  }

  if (options.fileExtension != null) {
    await uploader.setFileExtension(options.fileExtension!);
  }

  if (options.rwTimeout != null) {
    await uploader.setRWTimeout(options.rwTimeout!);
  }
  if (options.maxFailTime != null) {
    await uploader.setMaxFailTime(options.maxFailTime!);
  }
  if (options.classificationId != null) {
    await uploader.setClassificationId(options.classificationId!);
  }
  if (options.resumeConfigDir != null) {
    await uploader.setSDKConfigDirForAndroid(options.resumeConfigDir!);
  }
  if (options.enableResume != null) {
    await uploader.setDiskResumeOption((options.enableResume == true) ? 1 : 0);
  }
  if (options.title != null) {
    await uploader.setTitle(options.title!);
  }
  if (options.tags != null) {
    await uploader.setTags(options.tags!);
  }
  if (options.description != null) {
    await uploader.setDescription(options.description!);
  }
  if (options.format != null) {
    await uploader.setFormat(options.format!);
  }
  if (options.templateId != null) {
    await uploader.setTemplateId(options.templateId!);
  }

  return uploader;
}