From 1506c477a5aa29c2f73e68544f10bd2228c2ee62 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Jul 2026 04:08:48 +0000 Subject: [PATCH] Clamp the skip fade to the outgoing track's remaining audio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A fixed 5 s skip blend with less than 5 s of outgoing audio left ends in the file draining mid-fade at ~30% gain — an audible hard cut on short tracks and hot endings (reported skipping the first track of a playlist at ~26 s). Clamp the fade to the remaining audible time and fall back to a hard cut when under a second remains. --- .../Sources/Playback/Player+Transport.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Packages/ContinuityKit/Sources/Playback/Player+Transport.swift b/Packages/ContinuityKit/Sources/Playback/Player+Transport.swift index 613ff13..b690c5b 100644 --- a/Packages/ContinuityKit/Sources/Playback/Player+Transport.swift +++ b/Packages/ContinuityKit/Sources/Playback/Player+Transport.swift @@ -129,10 +129,21 @@ extension Player { startTimer() } resumeAfterInterruption = false + // Clamp the fade to the audio actually LEFT on the outgoing track: a 5 s blend with + // only 4 s of outgoing audio ends in the file draining at ~30% gain — an audible hard + // cut instead of a fade (short tracks / hot endings). Under a second remaining isn't + // enough to read as a blend at all — hard-advance instead. + let remaining = effectiveEndSeconds - position + guard remaining > 1 else { + currentIndex = targetIndex + startCurrentFresh() + persistState() + return + } beginTransition( toIndex: targetIndex, outgoingPosition: position, - duration: Player.skipTransitionDurationSeconds, + duration: min(Player.skipTransitionDurationSeconds, remaining), isUserInitiatedSkip: true ) persistState()