takeSnapshot static method
Implementation
static Future<Uint8List> takeSnapshot(String username, String password,
{required MediaUri snapshotUri}) async {
final auth = base64.encode(utf8.encode('$username:$password'));
final response = await Dio().get(snapshotUri.uri,
options: Options(
responseType: ResponseType.stream,
headers: {'Authorization': 'BASIC $auth'}));
final bytesBuilder = BytesBuilder();
await for (final chunk in response.data.stream) {
bytesBuilder.add(chunk);
}
return bytesBuilder.takeBytes();
}