takeSnapshotEx abstract method

Future<void> takeSnapshotEx({
  1. required RtcConnection connection,
  2. required int uid,
  3. required String filePath,
})

Takes a snapshot of a video stream.

The method is asynchronous, and the SDK has not taken the snapshot when the method call returns. After a successful method call, the SDK triggers the onSnapshotTaken callback to report whether the snapshot is successfully taken, as well as the details for that snapshot. This method takes a snapshot of a video stream from the specified user, generates a JPG image, and saves it to the specified path. Call this method after the joinChannelEx method. When used for local video snapshots, this method takes a snapshot for the video streams specified in ChannelMediaOptions. If the user's video has been preprocessed, for example, watermarked or beautified, the resulting snapshot includes the pre-processing effect.

  • connection The connection information. See RtcConnection.
  • uid The user ID. Set uid as 0 if you want to take a snapshot of the local user's video.
  • filePath The local path (including filename extensions) of the snapshot. For example: Windows: C:\Users<user_name>\AppData\Local\Agora<process_name>\example.jpg iOS: /App Sandbox/Library/Caches/example.jpg macOS: ~/Library/Logs/example.jpg Android: /storage/emulated/0/Android/data/

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.

Implementation

Future<void> takeSnapshotEx(
    {required RtcConnection connection,
    required int uid,
    required String filePath});