@klyftig/alarm-audio
v0.1.0
Published
Alarm-stream audio playback that survives silent mode: Android foreground service on STREAM_ALARM (volume ramp, extra-loud, vibration), iOS AVAudioSession .playback
Maintainers
Readme
@klyftig/alarm-audio
Expo native module: alarm-stream audio playback that survives silent mode.
Extracted from Sleepwise's modules/sleepwise-alarm-audio (2026-09-15); the
Kotlin/Swift identifiers still carry the SleepwiseAlarmAudio name.
- Android —
AlarmAudioService, a foreground service (mediaPlayback) playing onUSAGE_ALARM/STREAM_ALARM, so the tone rings on silent and vibrate. Volume ramp, extra-loud escalation, repeating vibration, audio focus,stopWithTask=false+START_REDELIVER_INTENT(self-heals ~5 s after an OEM force-kill),isPlaying()re-entry guard. - iOS —
AVAudioSession.playback(silent-switch exempt) looping player. Written, unverified on a physical iPhone.
import { playAlarmAudio, stopAlarmAudio, setAlarmAudioMuted, isAlarmRinging, isAlarmAudioAvailable } from '@klyftig/alarm-audio';
playAlarmAudio(uri, { loop: true, volume: 0.8, ramp: true, extraLoudAfterSec: 30, vibrate: true });Off-device (web / jest) requireNativeModule throws and the bridge degrades to
no-ops; isAlarmAudioAvailable() reports it. Consumers usually go through
@klyftig/alarm-core's startAlarmSound(alarm) which resolves the tone first.
Autolinks from node_modules (expo-module.config.json); needs a dev client
and a prebuild after install.
