---
title: AVAudioRoutingArbiter
framework: avfaudio
role: symbol
role_heading: Class
path: avfaudio/avaudioroutingarbiter
---

# AVAudioRoutingArbiter

An object for configuring macOS apps to participate in AirPods Automatic Switching.

## Declaration

```swift
class AVAudioRoutingArbiter
```

## Overview

Overview AirPods Automatic Switching is a feature of Apple operating systems that intelligently connects wireless headphones to the most appropriate audio device in a multidevice environment. For example, if a user plays a movie on iPad, and then locks the device and starts playing music on iPhone, the system automatically switches the source audio device from iPad to iPhone. iOS apps automatically participate in AirPods Automatic Switching. To enable your macOS app to participate in this behavior, use AVAudioRoutingArbiter to indicate when your app starts and finishes playing or recording audio. For example, a Voice over IP (VoIP) app might request arbitration before starting a call, and when the arbitration completes, begin the VoIP session. Likewise, when the call ends, the app would end the VoIP session and leave arbitration. func startCall() {     let arbiter = AVAudioRoutingArbiter.shared     arbiter.begin(category: .playAndRecordVoice) { deviceChanged, error in         // Start VoIP session.     } }

func endCall() {     // End VoIP session.     AVAudioRoutingArbiter.shared.leave() } important: Only certain Apple and Beats wireless headsets support this feature.

## Topics

### Creating a Routing Arbiter

- [shared](avfaudio/avaudioroutingarbiter/shared.md)

### Participating in AirPods Automatic Switching

- [begin(category:completionHandler:)](avfaudio/avaudioroutingarbiter/begin(category:completionhandler:).md)
- [AVAudioRoutingArbiter.Category](avfaudio/avaudioroutingarbiter/category.md)
- [leave()](avfaudio/avaudioroutingarbiter/leave().md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### System audio

- [Handling audio interruptions](avfaudio/handling-audio-interruptions.md)
- [Responding to audio route changes](avfaudio/responding-to-audio-route-changes.md)
- [Routing audio to specific devices in multidevice sessions](avfaudio/routing-audio-to-specific-devices-in-multidevice-sessions.md)
- [Adding synthesized speech to calls](avfaudio/adding-synthesized-speech-to-calls.md)
- [Capturing stereo audio from built-In microphones](avfaudio/capturing-stereo-audio-from-built-in-microphones.md)
- [AVAudioSession](avfaudio/avaudiosession.md)
- [AVAudioApplication](avfaudio/avaudioapplication.md)
