Skip to main content

Function: validateSleepTimerSeconds()

function validateSleepTimerSeconds(seconds: number): number;

Defined in: packages/media-session/src/validate.ts:528

Validate a sleep-timer duration.

Strictly positive: 0 is rejected rather than treated as "fire now" because the two plausible readings — "pause immediately" and "cancel" — are both already spelled out (pause() and cancelSleepTimer()), and picking one silently would make the other a bug that only shows up on a device with the screen off. NaN/Infinity are rejected here rather than downstream, where NaN * 1000 becomes a Long of 0 on Android and a timer that fires instantly.

Parameters

ParameterType
secondsnumber

Returns

number