takeSnapShot method

Future<Uint8List> takeSnapShot ()

Take snapshot (screen shot) of current playing video

If you want to use takeSnapshot, you must call player.setOption(FijkOption.hostCategory, "enable-snapshot", 1); after you create a FijkPlayer. Or else this method returns error.

Example:

var imageData = await player.takeSnapShot();
var provider = MemoryImage(v);
Widget image = Image(image: provider)

Implementation

Future<Uint8List> takeSnapShot() async {
  await _nativeSetup.future;
  FijkLog.i("$this takeSnapShot");
  if (_snapShot != null && !_snapShot.isCompleted) {
    return Future.error(StateError("last snapShot is not finished"));
  }
  _snapShot = Completer<Uint8List>();
  _channel.invokeMethod("snapshot");
  return _snapShot.future;
}