openCapture method

  1. @override
Future<CaptureSession> openCapture([
  1. CaptureConfig config = const CaptureConfig()
])
override

Opens a microphone capture session.

Does not request permission. A headless package has no UI to explain why it is asking, and the host does - so this throws CaptureUnavailable if the permission has not already been granted.

Implementation

@override
Future<CaptureSession> openCapture([
  CaptureConfig config = const CaptureConfig(),
]) async {
  final error = nextCaptureError;
  if (error != null) {
    nextCaptureError = null;
    throw error;
  }

  final session = FakeCaptureSession(config: config);
  sessions.add(session);
  return session;
}