downloadSource method

void downloadSource(
  1. List<RecordEventDetailBean?> tasks,
  2. bool isShare, {
  3. double? speedRatio,
  4. required OnProgress onProgress,
  5. required OnFinish onFinish,
})

speedRatio 变速下载(慢动作导出):取值 1 / 0.5 / 0.25 / 0.125, null 或 1 按原速。非 1x 输出不保留音轨(双端原生 SDK 行为)。 双端均支持:iOS 走 SDK ts2Mp4 转码参数,Android 写入每个任务的 RecordBean.downloadSpeed 后由原生下载控制器转码。

Implementation

void downloadSource(List<RecordEventDetailBean?> tasks, bool isShare,
    {double? speedRatio, required OnProgress onProgress, required OnFinish onFinish}) {
  if (speedRatio != null && !PlaybackSpeed.isValidDownloadRatio(speedRatio)) {
    throw ArgumentError.value(speedRatio, 'speedRatio', 'only 1, 0.5, 0.25, 0.125 are supported');
  }
  final args = {
    "class": "LibraryCore",
    "method": "downloadSource",
    "args": [jsonEncode(tasks), isShare, speedRatio, RegisterCallback(callback: DownloadResultListener(onProgress: onProgress, onFinish: onFinish))],
  };
  SDK.invoke(args);
}