audio.watch
Calls listener when the system interrupts the app's audio, and when the
interruption ends. In a component it stops when the component unmounts.
Usage
Show when a phone call interrupts audio.
// Show when a phone call interrupts audio.
import { Text, audio, signal, type AudioInterruption } from 'kuito';
export function AudioStatus() {
const interruption = signal<AudioInterruption | null>(null);
audio.watch('interruption', (event) => {
interruption.value = event;
});
return <Text>{interruption.value ? JSON.stringify(interruption.value) : 'No interruption'}</Text>;
}Signatures
(event: "interruption", listener: (interruption: AudioInterruption) => void): EventSubscriptionParameters
| Name | Type | Required | Description |
|---|---|---|---|
event | "interruption" | Yes | — |
listener | (interruption: AudioInterruption) => void | Yes | — |
Returns
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.