Skip to main content

Interface: NativeInterruptionEvent

Defined in: packages/audio-session/src/specs/audio-session.nitro.ts:205

Flat interruption payload as it crosses the bridge.

It is deliberately NOT a discriminated union of two structs: nitrogen cannot represent a single-member string-literal type as a struct discriminator (String literal "..." cannot be represented in C++ because it is ambiguous between a string and a discriminating union enum). The TS facade narrows this into the spec's AudioSessionInterruptionEvent union — see src/types.ts.

Properties

begin

begin: boolean;

Defined in: packages/audio-session/src/specs/audio-session.nitro.ts:207

true = interruption started, false = interruption ended.


permanent

permanent: boolean;

Defined in: packages/audio-session/src/specs/audio-session.nitro.ts:236

Only meaningful when begin is true. true when the session is gone for good and no begin: false event is coming.

  • Android: AUDIOFOCUS_LOSS.
  • iOS: a media-services failure (AVAudioSession.mediaServicesWereLostNotification / mediaServicesWereResetNotification), which destroys the session's configuration and is the one iOS condition with no .ended to follow.

Platform asymmetry — an ordinary iOS interruption is never permanent. A ceiling: AVAudioSession.InterruptionType.began carries no permanence information at all, and whether the interruption is recoverable is only knowable later, from .shouldResume on the .ended notification. Android says so up front; iOS cannot.


shouldResume

shouldResume: boolean;

Defined in: packages/audio-session/src/specs/audio-session.nitro.ts:219

Only meaningful when begin is false.

iOS: AVAudioSession.InterruptionOptions.shouldResume. Android: true for AUDIOFOCUS_GAIN after a transient loss.

On both platforms this means "the system permits resuming", never "you were playing" — see AudioSessionPlayerLike.isPlaying in src/wire.ts.


type

type: AudioInterruptionType;

Defined in: packages/audio-session/src/specs/audio-session.nitro.ts:209

Only meaningful when begin is true.