Skip to main content

resolve_skip_action

Function resolve_skip_action 

Source
pub fn resolve_skip_action(
    is_next: bool,
    is_background_audio: bool,
    position: f64,
    duration: Option<f64>,
) -> SkipAction
Expand description

Decide whether a lockscreen skip advances the queue or scrubs the current item.

Music gets queue advance, which is what the buttons look like they do. A video whose audio is playing through a background-audio handoff (UR-040) gets a relative scrub instead: there is no meaningful “next track” inside a film, and jumping to the next episode because the user wanted to re-hear a line is a much worse outcome than a scrub.

is_background_audio is the whole test, and it is sufficient on its own — the handoff exists only for video, and an episode played through it reports MediaType::Audio, so media type cannot distinguish this case (see the note at PlayerController::auto_advance_to_next_episode).

Clamped to [0, duration] so a skip near either end lands in the item rather than at a negative offset or past the end, which some backends treat as EOF and would turn a scrub into an unintended advance.

TRACES: UR-040, UR-006 | DR-201