Skip to main content

Function: stepRemoteVolume()

function stepRemoteVolume(
volume: number,
steps: number,
direction: -1 | 1
): number;

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

The volume one hardware key press lands on, as a normalised 0..1 level.

The library's own fallback for an app that implements MediaHandler.onSetDeviceVolume but not onAdjustDeviceVolume — which is the common case, because an absolute backend has no "nudge" call to wrap. A notch is 1 / steps, applied to the last published volume and clamped, so the arithmetic lives in one tested place rather than in every app.

Pure on purpose: the whole of the fallback's behaviour is this function.

Parameters

ParameterType
volumenumber
stepsnumber
direction-1 | 1

Returns

number