AudioRouteChangeInfo

data class AudioRouteChangeInfo(val reason: String, val previousRoute: String)

Describes an audio route change event, such as headphones being plugged in or disconnected, or a Bluetooth device connecting.

Route changes can affect audio playback and recording. For example, when headphones are unplugged, audio output typically switches to the built-in speaker, which may require the application to pause playback or adjust volume.

Platform Behavior

  • Android: On API 37 and later, Oboe reports AudioStreamRoutingCallback while a stream is open and its routed devices change without disconnecting the stream. reason is "RoutingChanged". previousRoute is the previous device id list ("unspecified" when there was none). Earlier Android versions disconnect the stream instead, and that path does not emit here.

  • Apple: Route changes are reported via AVAudioSession.routeChangeNotification.

Constructors

Link copied to clipboard
constructor(reason: String, previousRoute: String)

Properties

Link copied to clipboard

A human-readable description of the audio route that was active before the change occurred. Useful for logging or for deciding whether to take action (e.g., pausing playback when headphones are removed).

Link copied to clipboard

A human-readable string describing why the route changed. Examples: "NewDeviceAvailable", "OldDeviceUnavailable", "CategoryChange". The exact values are platform-dependent.