begin(category:completionHandler:)
Begins routing arbitration to take ownership of a nearby Bluetooth audio route.
Declaration
func begin(category: AVAudioRoutingArbiter.Category, completionHandler handler: @escaping @Sendable (Bool, (any Error)?) -> Void)func begin(category: AVAudioRoutingArbiter.Category) async throws -> BoolParameters
- category:
A category that describes how the app uses audio.
- handler:
A completion handler the system calls asynchronously when the system completes audio routing arbitration. This closure takes the following parameters:
- defaultDeviceChanged
A Boolean value that indicates whether the system switched the AirPods to the macOS device.
- error
An error object that indicates why the request failed, or Nil 227m0 if the request succeeded.
Discussion
Call this method to tell the operating system to arbitrate with nearby Apple devices to take ownership of a supported Bluetooth audio device. When arbitration completes, the system calls the completion handler, passing a Boolean that indicates whether the audio device changed. In either case, begin using audio as normal.