takeRemoteSnapshotToFile method

Future<int?> takeRemoteSnapshotToFile(
  1. string streamId,
  2. string filePath
)

@detail api @author wangfujun.911 @brief 截取远端的视频流画面,生成 JPG 文件,并保存到本地指定路径。
调用该方法后,SDK 会触发回调 onRemoteSnapshotTakenToFile{@link #IRTCEngineEventHandler#onRemoteSnapshotTakenToFile} 报告截图是否成功,以及截取的图片信息。 @param streamId 待截取的远端视频流 ID。 @param filePath 截图的本地保存路径(绝对路径),需精确到文件名及格式,文件扩展名必须为 .jpg,并请确保路径存在且可写。示例:/sdcard/Pictures/snapshot.jpg。 @return 远端截图任务的编号,从 1 开始递增。此编号可用于追踪任务状态或进行其他管理操作。

Implementation

Future<int?> takeRemoteSnapshotToFile(
    string streamId, string filePath) async {
  $a() => ($instance as $p_a.RTCEngine)
      .takeRemoteSnapshotToFile(streamId, filePath);
  $i() => ($instance as $p_i.ByteRTCEngine)
      .takeRemoteSnapshotToFile(streamId, filePath);

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}