snapshot method
Future<void>
snapshot(
- int count,
- int interval,
- String dir, {
- AlivcLiveSnapshotDirType? dirTypeForIOS,
截图
count
截图次数
interval
截图间隔
dir
截图保存路径。Android系统下是全路径,iOS系统下是沙盒存放相对文件夹路径。如果需要监听截图回调setSnapshotDelegate,需要设置。
dirTypeForIOS
iOS系统下沙盒目录,可选。 默认:AlivcLiveSnapshotDirType.document。如果需要监听截图回调setSnapshotDelegate,iOS系统下可选设置。
Implementation
Future<void> snapshot(int count, int interval, String dir,
{AlivcLiveSnapshotDirType? dirTypeForIOS}) async {
Map params = {
"count": count.toString(),
"interval": interval.toString(),
};
if (Platform.isIOS) {
params["saveDir"] = {
"dirType": (dirTypeForIOS ?? AlivcLiveSnapshotDirType.document)
.index
.toString(),
"dir": dir,
};
} else {
params["saveDir"] = dir;
}
return _livePusherMethodChannel.invokeMethod(
'snapshot',
wrapArgs(arg: params),
);
}