postFrameCallback method
void
postFrameCallback(
- Duration timestamp
)
Implementation
void postFrameCallback(Duration timestamp) async {
if (_record == false) {
return;
}
if (skipped > 0) {
// count down frames which should be skipped
skipped = skipped - 1;
// add a new PostFrameCallback to know about the next frame
_binding.addPostFrameCallback(postFrameCallback);
// but we do nothing, because we skip this frame
return;
}
if (skipped == 0) {
// reset skipped frame counter
skipped = skipped + skipFramesBetweenCaptures;
}
try {
final image = capture();
if (image == null) {
debugPrint('capture returned null');
return;
}
_exporter.onNewFrame(Frame(timestamp, image));
} catch (e) {
debugPrint(e.toString());
}
_binding.addPostFrameCallback(postFrameCallback);
}