setCategory(_:mode:policy:options:)
Sets the session category, mode, route-sharing policy, and options.
Declaration
func setCategory(_ category: AVAudioSession.Category, mode: AVAudioSession.Mode, policy: AVAudioSession.RouteSharingPolicy, options: AVAudioSession.CategoryOptions = []) throwsParameters
- category:
The category to apply to the audio session. See Category Swift.struct for supported category values.
- mode:
The audio session mode to apply to the audio session. For a list of values, see Mode Swift.struct.
- policy:
The route-sharing policy to apply to the audio session. For a list of values, see Routesharingpolicy Swift.enum.
- options:
A mask of additional options for handling audio. For a list of constants, see Categoryoptions Swift.struct.
Discussion
You specify options only with a default routing policy. With a long-form route-sharing policy, you can use the playback category and the default, moviePlayback, and spokenAudio modes.