startImageStream method

Future<void> startImageStream({
  1. UFrameFormat? format,
  2. double? maxFps,
  3. int? downscale,
})

Implementation

Future<void> startImageStream({UFrameFormat? format, double? maxFps, int? downscale}) async {
  final int? id = _sessionId;
  if (id == null || value.isStreamingFrames) return;
  _frames ??= UCameraChannel.frames(id).listen(_onFrame, onError: _onStreamError);
  await _set("startImageStream", <String, Object?>{
    "format": (format ?? _config.frameFormat).name,
    "maxFps": maxFps ?? _config.frameMaxFps,
    "downscale": downscale ?? _config.frameDownscale,
  });
  _emit(value.copyWith(isStreamingFrames: true));
}