setPreferredInput(_:)
Sets the preferred input port for audio routing.
Declaration
func setPreferredInput(_ inPort: AVAudioSessionPortDescription?) throwsParameters
- inPort:
An Avaudiosessionportdescription object that describes the port to use for input.
Discussion
Setting the preferred input port requests a change to the input audio route. To determine whether the change has taken effect, use the currentRoute property.
The value of the inPort parameter must be one of the AVAudioSessionPortDescription objects in the availableInputs array. If this parameter specifies a port that isn’t already part of the current audio route and the app’s session controls audio routing, this method initiates a route change to use the preferred port.
You must set a preferred input port only after setting the audio session’s category and mode and activating the session.