takeSnapshotEx abstract method
Future<void>
takeSnapshotEx({
- required RtcConnection connection,
- required int uid,
- required String filePath,
使用连接 ID 获取视频截图。
该方法用于对指定用户的视频流进行截图,生成一张 JPG 格式的图片,并保存至指定的路径。 该方法是异步操作,调用返回时 SDK 并没有真正获取截图。 该方法用于本地视频截图时,是对 ChannelMediaOptions 中指定发布的视频流进行截图。 如果用户的视频经过前处理,例如,添加了水印或美颜,生成的截图会包含前处理效果。
connectionConnection 信息。详见 RtcConnection 。uid用户 ID。如果要对本地用户的视频截图,则设为 0。filePath请确保目录存在且可写。 截图的本地保存路径,需精确到文件名及格式,例如: 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 方法成功调用时,无返回值;方法调用失败时,会抛出 AgoraRtcException 异常,你需要捕获异常并进行处理。详见错误码了解详情和解决建议。
Implementation
Future<void> takeSnapshotEx(
{required RtcConnection connection,
required int uid,
required String filePath});