takeRemoteSnapshotToFile method

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

@detail api @author wangfujun.911 @brief Takes snapshot of the remote video stream and save it as a JPG file at the specified local path.
After calling this method, the SDK triggers onRemoteSnapshotTakenToFile{@link #IRTCEngineEventHandler#onRemoteSnapshotTakenToFile} to report whether the snapshot is taken successfully and provide details of the snapshot image. @param streamId ID of the remote video stream. @param filePath The absolute file path where the snapshot JPG file will be saved. The file extension must be .jpg. Ensure that the directory exists and is writable. Example: /sdcard/Pictures/snapshot.jpg. @return The index of the remote snapshot task, starting from 1. The index can be used to track the task status or perform other management operations.

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}');
  }
}