takePlayStreamSnapshot method
Implementation
Future<dynamic> takePlayStreamSnapshot(String streamID) async {
final result = ZegoFlutterEngine.instance.takePlayStreamSnapshot(streamID);
// final result = await promiseToFuture(promise);
final Map<dynamic, dynamic> map = {};
final errorCode = getProperty(result, 'errorCode');
map['errorCode'] = errorCode;
map['image'] = null;
final imageURL = getProperty(result, 'image') as String;
if (imageURL.startsWith('data:image/')) {
// 提取 Base64 数据
final base64Data = imageURL.split(',')[1];
// 解码 Base64 数据
Uint8List bytes = base64.decode(base64Data);
// 返回 MemoryImage
map['image'] = bytes;
}
return map;
}