openCapture method

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

This method opens a microphone capture session.

This method does not request permission. A headless package has no UI to give the reason for the request, and the host has one. If the permission is not already granted, this method throws CaptureUnavailable.

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;
}