snapshot method
Take a snapshot for current rendered frame.
width
snapshot width. if not set, result is mediaInfo.video[current_track].codec.width
height
snapshot height. if not set, result is mediaInfo.video[current_track].codec.height
Return rgba data of image size width
xheight
, stride is width*4
Implementation
Future<Uint8List?> snapshot({int? width, int? height}) {
if (!(_snapshot?.isCompleted ?? true)) {
_snapshot?.complete(null);
}
_snapshot = Completer<Uint8List?>();
if (!Libfvp.snapshot(nativeHandle, width ?? 0, height ?? 0,
NativeApi.postCObject.cast(), _receivePort.sendPort.nativePort)) {
_snapshot!.complete(null);
}
return _snapshot!.future;
}