Contents

setPrefersInterruptionOnRouteDisconnect(_:)

Sets a preference to interrupt the audio session when the active route disconnects.

Declaration

func setPrefersInterruptionOnRouteDisconnect(_ inValue: Bool) throws

Parameters

  • inValue:

    Specify a False value to opt out of interruption on route disconnect. Set to True to reset to the default behavior.

Discussion

The expected behavior of an app is to pause playback if a route change occurs due to a device no longer being available (AVAudioSession.RouteChangeReason.oldDeviceUnavailable). Starting in iOS 17, the system interrupts active Now Playing sessions when a route change occurs due to a disconnection event, but doesn’t interrupt other sessions.

See Also

Handling interruptions