takeVideo method

Future<void> takeVideo()

Starts an allowed video capture, with sound when available.

Implementation

Future<void> takeVideo() async {
  if (_closed || _capturing || recording || filter == XAssetKind.image) {
    return;
  }
  _capturing = true;
  _photo = false;
  _safeNotify();
  try {
    final controller = await ensureAudio();
    if (_closed || controller == null) return;
    await session.useController(
      (controller) => controller.startVideoRecording(),
    );
  } catch (error, stack) {
    _captureError(error, stack);
  } finally {
    _capturing = false;
    _safeNotify();
  }
}