observeRouteChanges

actual fun observeRouteChanges(listener: (AudioRouteChangeInfo) -> Unit)

Register a listener for audio route change events.

Replaces any previous listener. On Apple (iOS/tvOS/watchOS) this installs an AVAudioSession route-change observer. On Android API 37 and later, an open stream reports Oboe routing changes here when the route changes without disconnecting the stream (reason is "RoutingChanged"). Call clearRouteChanges to remove the listener. JVM, JS, desktop, and macOS do not emit from this API.

Parameters

listener

Callback invoked when the audio route changes (e.g., headphones plugged in/out).

actual fun observeRouteChanges(listener: (AudioRouteChangeInfo) -> Unit)

Register a listener for audio route change events.

Replaces any previous listener. On Apple (iOS/tvOS/watchOS) this installs an AVAudioSession route-change observer. On Android API 37 and later, an open stream reports Oboe routing changes here when the route changes without disconnecting the stream (reason is "RoutingChanged"). Call clearRouteChanges to remove the listener. JVM, JS, desktop, and macOS do not emit from this API.

Parameters

listener

Callback invoked when the audio route changes (e.g., headphones plugged in/out).

expect fun observeRouteChanges(listener: (AudioRouteChangeInfo) -> Unit)

Register a listener for audio route change events.

Replaces any previous listener. On Apple (iOS/tvOS/watchOS) this installs an AVAudioSession route-change observer. On Android API 37 and later, an open stream reports Oboe routing changes here when the route changes without disconnecting the stream (reason is "RoutingChanged"). Call clearRouteChanges to remove the listener. JVM, JS, desktop, and macOS do not emit from this API.

Parameters

listener

Callback invoked when the audio route changes (e.g., headphones plugged in/out).

actual fun observeRouteChanges(listener: (AudioRouteChangeInfo) -> Unit)

Register a listener for audio route change events.

Replaces any previous listener. On Apple (iOS/tvOS/watchOS) this installs an AVAudioSession route-change observer. On Android API 37 and later, an open stream reports Oboe routing changes here when the route changes without disconnecting the stream (reason is "RoutingChanged"). Call clearRouteChanges to remove the listener. JVM, JS, desktop, and macOS do not emit from this API.

Parameters

listener

Callback invoked when the audio route changes (e.g., headphones plugged in/out).

actual fun observeRouteChanges(listener: (AudioRouteChangeInfo) -> Unit)

Register a listener for audio route change events.

Replaces any previous listener. On Apple (iOS/tvOS/watchOS) this installs an AVAudioSession route-change observer. On Android API 37 and later, an open stream reports Oboe routing changes here when the route changes without disconnecting the stream (reason is "RoutingChanged"). Call clearRouteChanges to remove the listener. JVM, JS, desktop, and macOS do not emit from this API.

Parameters

listener

Callback invoked when the audio route changes (e.g., headphones plugged in/out).

actual fun observeRouteChanges(listener: (AudioRouteChangeInfo) -> Unit)

Register a listener for audio route change events.

Replaces any previous listener. On Apple (iOS/tvOS/watchOS) this installs an AVAudioSession route-change observer. On Android API 37 and later, an open stream reports Oboe routing changes here when the route changes without disconnecting the stream (reason is "RoutingChanged"). Call clearRouteChanges to remove the listener. JVM, JS, desktop, and macOS do not emit from this API.

Parameters

listener

Callback invoked when the audio route changes (e.g., headphones plugged in/out).