Skip to main content
cngx-src documentation

CngxAudioStatus

DirectivePrimaryv0.1.0WCAG AA

projects/common/audio/status-mode/audio-status.directive.ts

Import#

import { CngxAudioStatus } from '@cngx/common/audio'

Description#

Status-mode audio bridge. Maps CngxAsyncState lifecycle transitions to earcons via the status:earcon grammar — the audition counterpart of CngxToastOn. Fires only on a real status transition, never on the initial idle, and at most once per transition.

<button [cngxAsyncClick]="upload"
  #upload="cngxAsyncClick"
  [state]="upload.state"
  [cngxAudioStatus]="'pending:tap, succeeded:success, failed:error'">
  Upload
</button>

The state source resolves the same way the feedback bridges do: an explicit [state] input wins, otherwise it falls back to an ancestor's CNGX_STATEFUL. The grammar keys are lifecycle statuses only — DOM-event keys (click, focus, …) belong to [cngxAudio] and are rejected with a dev-error. succeeded/failed are accepted as aliases for success/error.

https://cngxjs.github.io/cngx/examples/#/common/audio/status-bridge/async-click

Metadata#

Index#

Inputs#

audioDisabled#
input()

Suppress this element's audio without unbinding.

default false, { transform: booleanAttribute }
audioVolume#number | undefined
input()

Per-element volume multiplier in [0, 1]; unset uses the engine volume.

input()

The status:earcon grammar, e.g. 'pending:tap, succeeded:success'.

default '', { alias: 'cngxAudioStatus' }

The async state to watch. Optional — when omitted, the bridge falls back to an ancestor CNGX_STATEFUL. A bare [state] attribute (empty string) is treated as "no input bound" so the fallback kicks in.

default undefined, { transform: (v) => (typeof v === 'string' ? undefined : v), }