Contents

setCategory(_:options:)

Sets the audio session’s category with the specified options.

Declaration

func setCategory(_ category: AVAudioSession.Category, options: AVAudioSession.CategoryOptions = []) throws

Parameters

Discussion

The audio session’s category defines how you intend to use audio in your app. Typically, you set the category before activating the session. You can also set the category while the session is active, but doing so results in an immediate route change.

You can tailor the behavior of certain categories by specifying a mask of category options. Specifying an unsupported option for the indicated category results in an error. See AVAudioSession.CategoryOptions for category compatibility.

See Also

Configuring standard audio behaviors