---
title: "providerWithSession(from:compatibleWith:priority:)"
framework: speech
role: symbol
role_heading: Type Method
path: "speech/captureinputsequenceprovider/providerwithsession(from:compatiblewith:priority:)"
---

# providerWithSession(from:compatibleWith:priority:)

Returns an input sequence provider that reads from an audio capture device, and configures a new audio capture session with that device.

## Declaration

```swift
static func providerWithSession(from captureDevice: AVCaptureDevice, compatibleWith modules: [any SpeechModule], priority: TaskPriority? = nil) async throws -> CaptureInputSequenceProvider
```

## Parameters

- `captureDevice`: The capture device to use.
- `modules`: The speech modules that will analyze the audio.
- `priority`: The desired priority of the audio-capture task.

## Return Value

Return Value An instance of this class.

## Discussion

Discussion This method also creates and configures a new AVCaptureSession with default settings. Initializing a session can take some time; you should call this method in a background task. Use the captureSession property to start, stop, or otherwise manage the capture session. note: On iOS, tvOS, visionOS, and watchOS platforms, this method automatically configures your application’s default AVAudioSession. To avoid this behavior, call provider(from:in:compatibleWith:priority:) instead.

## See Also

### Creating a provider

- [provider(from:in:compatibleWith:priority:)](speech/captureinputsequenceprovider/provider(from:in:compatiblewith:priority:).md)
- [init(session:analyzerFormat:priority:)](speech/captureinputsequenceprovider/init(session:analyzerformat:priority:).md)
