snapshotVideo method

Future<void> snapshotVideo(
  1. String? userId,
  2. int streamType,
  3. int sourceType,
  4. String path,
)

Screencapture video

This API takes screenshots of the local, remote primary stream, or remote substream image.

Parameters:

userId: User ID. null indicates to screencapture the local video. For the local video, only the camera image (TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG) can be screencaptured.

streamType: Video stream type. Camera image (TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG) and screen sharing image (TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_SUB) are supported.

path: This path must be accurate to the file name and extension. The extension determines the format of the image. Currently, supported formats include PNG, JPG, and WEBP. For example, if the specified path is path/to/test.png, then a PNG image will be generated. Please specify a valid path with read/write permissions; otherwise, the image file cannot be generated.

Platform not supported:

  • web

Implementation

Future<void> snapshotVideo(
  String?
      userId, // User ID. `null` indicates to screencapture the local video. For the local video, only the camera image (TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG) can be screencaptured.
  int streamType, // Video stream type. Camera image (TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG) and screen sharing image (TRTCCloudDef#TRTC_VIDEO_STREAM_TYPE_SUB) are supported.
  int sourceType, // 0-stream  1-view
  String path, // Screenshot storage address
) {
  return _cloudChannel!.invokeMethod('snapshotVideo', {
    "userId": userId,
    "streamType": streamType,
    "path": path,
    "sourceType": sourceType
  });
}