Contents

setCategory(_:mode:options:)

Sets the audio session’s category, mode, and options.

Declaration

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

Parameters

  • 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.

  • options:

    A mask of additional options for handling audio. For a list of constants, see Categoryoptions Swift.struct.

Discussion

The audio session’s category and mode together define how your app uses audio. Typically, you set the category and mode before activating the session. You can also set the category or mode while the session is active, but doing so results in an immediate change.

See Also

Configuring standard audio behaviors