Temporarily changes the current audio route.
- iOS 6.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
The override option for audio output. For a list of constants, see
Session Port Override
On input, a pointer to an error object. If an error occurs, the pointer is set to an
NSErrorobject that describes the error. If you do not want error information, pass in
YES if the new audio routing option was set successfully, or
NO if it was not.
If your app uses the
AVAudio category, calling this method with the
AVAudio option causes audio to be routed to the built-in speaker and microphone regardless of other settings. This change remains in effect only until the current route changes or you call this method again with the
If you would prefer to permanently enable this behavior, you should instead set the category's
AVAudio option. Setting this option will always route to the speaker rather than receiver if no other accessory such as headphones are in use.