@dashdoc/react-native-system-sounds
Version:
A module to play system sounds and beeps for React Native on iOS and Android (no sound files).
240 lines (239 loc) • 9.9 kB
TypeScript
import { AndroidSoundIDs, iOSSoundIDs } from "./constants";
type TSoundId = typeof AndroidSoundIDs[keyof typeof AndroidSoundIDs] | typeof iOSSoundIDs[keyof typeof iOSSoundIDs];
declare class RNSystemSounds {
static AndroidSoundIDs: {
readonly TONE_CDMA_ABBR_ALERT: 97;
readonly TONE_CDMA_ABBR_INTERCEPT: 37;
readonly TONE_CDMA_ABBR_REORDER: 39;
readonly TONE_CDMA_ALERT_AUTOREDIAL_LITE: 87;
readonly TONE_CDMA_ALERT_CALL_GUARD: 93;
readonly TONE_CDMA_ALERT_INCALL_LITE: 91;
readonly TONE_CDMA_ALERT_NETWORK_LITE: 86;
readonly TONE_CDMA_ANSWER: 42;
readonly TONE_CDMA_CALLDROP_LITE: 95;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP: 46;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL: 45;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_PAT3: 48;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_PAT5: 50;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_PAT6: 51;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_PAT7: 52;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING: 49;
readonly TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI: 47;
readonly TONE_CDMA_CONFIRM: 41;
readonly TONE_CDMA_DIAL_TONE_LITE: 34;
readonly TONE_CDMA_EMERGENCY_RINGBACK: 92;
readonly TONE_CDMA_HIGH_L: 53;
readonly TONE_CDMA_HIGH_PBX_L: 71;
readonly TONE_CDMA_HIGH_PBX_SLS: 80;
readonly TONE_CDMA_HIGH_PBX_SS: 74;
readonly TONE_CDMA_HIGH_PBX_SSL: 77;
readonly TONE_CDMA_HIGH_PBX_S_X4: 83;
readonly TONE_CDMA_HIGH_SLS: 65;
readonly TONE_CDMA_HIGH_SS: 56;
readonly TONE_CDMA_HIGH_SSL: 59;
readonly TONE_CDMA_HIGH_SS_2: 62;
readonly TONE_CDMA_HIGH_S_X4: 68;
readonly TONE_CDMA_INTERCEPT: 36;
readonly TONE_CDMA_KEYPAD_VOLUME_KEY_LITE: 89;
readonly TONE_CDMA_LOW_L: 55;
readonly TONE_CDMA_LOW_PBX_L: 73;
readonly TONE_CDMA_LOW_PBX_SLS: 82;
readonly TONE_CDMA_LOW_PBX_SS: 76;
readonly TONE_CDMA_LOW_PBX_SSL: 79;
readonly TONE_CDMA_LOW_PBX_S_X4: 85;
readonly TONE_CDMA_LOW_SLS: 67;
readonly TONE_CDMA_LOW_SS: 58;
readonly TONE_CDMA_LOW_SSL: 61;
readonly TONE_CDMA_LOW_SS_2: 64;
readonly TONE_CDMA_LOW_S_X4: 70;
readonly TONE_CDMA_MED_L: 54;
readonly TONE_CDMA_MED_PBX_L: 72;
readonly TONE_CDMA_MED_PBX_SLS: 81;
readonly TONE_CDMA_MED_PBX_SS: 75;
readonly TONE_CDMA_MED_PBX_SSL: 78;
readonly TONE_CDMA_MED_PBX_S_X4: 84;
readonly TONE_CDMA_MED_SLS: 66;
readonly TONE_CDMA_MED_SS: 57;
readonly TONE_CDMA_MED_SSL: 60;
readonly TONE_CDMA_MED_SS_2: 63;
readonly TONE_CDMA_MED_S_X4: 69;
readonly TONE_CDMA_NETWORK_BUSY: 40;
readonly TONE_CDMA_NETWORK_BUSY_ONE_SHOT: 96;
readonly TONE_CDMA_NETWORK_CALLWAITING: 43;
readonly TONE_CDMA_NETWORK_USA_RINGBACK: 35;
readonly TONE_CDMA_ONE_MIN_BEEP: 88;
readonly TONE_CDMA_PIP: 44;
readonly TONE_CDMA_PRESSHOLDKEY_LITE: 90;
readonly TONE_CDMA_REORDER: 38;
readonly TONE_CDMA_SIGNAL_OFF: 98;
readonly TONE_CDMA_SOFT_ERROR_LITE: 94;
readonly TONE_DTMF_0: 0;
readonly TONE_DTMF_1: 1;
readonly TONE_DTMF_2: 2;
readonly TONE_DTMF_3: 3;
readonly TONE_DTMF_4: 4;
readonly TONE_DTMF_5: 5;
readonly TONE_DTMF_6: 6;
readonly TONE_DTMF_7: 7;
readonly TONE_DTMF_8: 8;
readonly TONE_DTMF_9: 9;
readonly TONE_DTMF_A: 12;
readonly TONE_DTMF_B: 13;
readonly TONE_DTMF_C: 14;
readonly TONE_DTMF_D: 15;
readonly TONE_DTMF_P: 11;
readonly TONE_DTMF_S: 10;
readonly TONE_PROP_ACK: 25;
readonly TONE_PROP_BEEP: 24;
readonly TONE_PROP_BEEP2: 28;
readonly TONE_PROP_NACK: 26;
readonly TONE_PROP_PROMPT: 27;
readonly TONE_SUP_BUSY: 17;
readonly TONE_SUP_CALL_WAITING: 22;
readonly TONE_SUP_CONFIRM: 32;
readonly TONE_SUP_CONGESTION: 18;
readonly TONE_SUP_CONGESTION_ABBREV: 31;
readonly TONE_SUP_DIAL: 16;
readonly TONE_SUP_ERROR: 21;
readonly TONE_SUP_INTERCEPT: 29;
readonly TONE_SUP_INTERCEPT_ABBREV: 30;
readonly TONE_SUP_PIP: 33;
readonly TONE_SUP_RADIO_ACK: 19;
readonly TONE_SUP_RADIO_NOTAVAIL: 20;
readonly TONE_SUP_RINGTONE: 23;
};
static iOSSoundIDs: {
readonly MailReceived: 1000;
readonly MailSent: 1001;
readonly VoicemailReceived: 1002;
readonly SMSReceived: 1003;
readonly SMSSent: 1004;
readonly CalendarAlert: 1005;
readonly LowPower: 1006;
readonly SMSReceived_Alert1: 1007;
readonly SMSReceived_Alert2: 1008;
readonly SMSReceived_Alert3: 1009;
readonly SMSReceived_Alert4: 1010;
readonly SMSReceived_Vibrate: 1011;
readonly SMSReceived_Alert5: 1012;
readonly SMSReceived_Alert6: 1013;
readonly SMSReceived_Alert7: 1014;
readonly Voicemail: 1015;
readonly SMSSent1: 1016;
readonly SMSReceived_Alert8: 1020;
readonly SMSReceived_Alert9: 1021;
readonly SMSReceived_Alert10: 1022;
readonly SMSReceived_Alert11: 1023;
readonly SMSReceived_Alert12: 1024;
readonly SMSReceived_Alert13: 1025;
readonly SMSReceived_Alert14: 1026;
readonly SMSReceived_Alert15: 1027;
readonly SMSReceived_Alert16: 1028;
readonly SMSReceived_Alert17: 1029;
readonly SMSReceived_Alert18: 1030;
readonly SMSReceived_Alert19: 1031;
readonly SMSReceived_Alert20: 1032;
readonly SMSReceived_Alert21: 1033;
readonly SMSReceived_Alert22: 1034;
readonly SMSReceived_Alert23: 1035;
readonly SMSReceived_Alert24: 1036;
readonly USSDAlert: 1050;
readonly SIMToolkitTone1: 1051;
readonly SIMToolkitTone2: 1052;
readonly SIMToolkitTone3: 1053;
readonly SIMToolkitTone4: 1054;
readonly SIMToolkitTone5: 1055;
readonly PINKeyPressed: 1057;
readonly AudioToneBusy: 1070;
readonly AudioToneCongestion: 1071;
readonly AudioTonePathAcknowledge: 1072;
readonly AudioToneError: 1073;
readonly AudioToneCallWaiting: 1074;
readonly AudioToneKey2: 1075;
readonly ScreenLocked: 1100;
readonly ScreenUnlocked: 1101;
readonly FailedUnlock: 1102;
readonly KeyPressed1: 1103;
readonly KeyPressed2: 1104;
readonly KeyPressed3: 1105;
readonly ConnectedToPower: 1106;
readonly RingerSwitchIndication: 1107;
readonly CameraShutter: 1108;
readonly ShakeToShuffle: 1109;
readonly JBL_Begin: 1110;
readonly JBL_Confirm: 1111;
readonly JBL_Cancel: 1112;
readonly BeginRecording: 1113;
readonly EndRecording: 1114;
readonly JBL_Ambiguous: 1115;
readonly JBL_NoMatch: 1116;
readonly BeginVideoRecording: 1117;
readonly EndVideoRecording: 1118;
readonly VCInvitationAccepted: 1150;
readonly VCRinging: 1151;
readonly VCEnded: 1152;
readonly VCCallWaiting: 1153;
readonly VCCallUpgrade: 1154;
readonly TouchTone1: 1200;
readonly TouchTone2: 1201;
readonly TouchTone3: 1202;
readonly TouchTone4: 1203;
readonly TouchTone5: 1204;
readonly TouchTone6: 1205;
readonly TouchTone7: 1206;
readonly TouchTone8: 1207;
readonly TouchTone9: 1208;
readonly TouchTone10: 1209;
readonly TouchTone11: 1210;
readonly TouchTone12: 1211;
readonly Headset_StartCall: 1254;
readonly Headset_Redial: 1255;
readonly Headset_AnswerCall: 1256;
readonly Headset_EndCall: 1257;
readonly Headset_CallWaitingActions: 1258;
readonly Headset_TransitionEnd: 1259;
readonly SystemSoundPreview1: 1300;
readonly SystemSoundPreview2: 1301;
readonly SystemSoundPreview3: 1302;
readonly SystemSoundPreview4: 1303;
readonly SystemSoundPreview5: 1304;
readonly SystemSoundPreview6: 1305;
readonly KeyPressClickPreview: 1306;
readonly SMSReceived_Selection1: 1307;
readonly SMSReceived_Selection2: 1308;
readonly SMSReceived_Selection3: 1309;
readonly SMSReceived_Selection4: 1310;
readonly SMSReceived_Vibrate2: 1311;
readonly SMSReceived_Selection5: 1312;
readonly SMSReceived_Selection6: 1313;
readonly SMSReceived_Selection7: 1314;
readonly SystemSoundPreview: 1315;
readonly SMSReceived_Selection8: 1320;
readonly SMSReceived_Selection9: 1321;
readonly SMSReceived_Selection10: 1322;
readonly SMSReceived_Selection11: 1323;
readonly SMSReceived_Selection12: 1324;
readonly SMSReceived_Selection13: 1325;
readonly SMSReceived_Selection14: 1326;
readonly SMSReceived_Selection15: 1327;
readonly SMSReceived_Selection16: 1328;
readonly SMSReceived_Selection17: 1329;
readonly SMSReceived_Selection18: 1330;
readonly SMSReceived_Selection19: 1331;
readonly SMSReceived_Selection20: 1332;
readonly SMSReceived_Selection21: 1333;
readonly SMSReceived_Selection22: 1334;
readonly SMSReceived_Selection23: 1335;
readonly SMSReceived_Selection24: 1336;
readonly RingerVibeChanged: 1350;
readonly SilentVibeChanged: 1351;
readonly Vibrate: 4095;
};
static Beeps: {
Positive: 24 | 1256 | undefined;
Negative: 25 | 1257 | undefined;
};
static play(soundID: TSoundId): void;
static beep(soundID?: TSoundId): void;
}
export default RNSystemSounds;