From 59c71b71fbb9124f3cc5dae8ec7734f6bd54ec57 Mon Sep 17 00:00:00 2001 From: Denis Arnst Date: Wed, 29 Nov 2023 17:30:34 +0100 Subject: [PATCH] Fix track skipping on iOS (Fixes #686) When we seek into a different chapter, we will have to reset the progress of the current one before seeking to the new one. --- ios/App/Shared/player/AudioPlayer.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ios/App/Shared/player/AudioPlayer.swift b/ios/App/Shared/player/AudioPlayer.swift index 877f61a8..665d776c 100644 --- a/ios/App/Shared/player/AudioPlayer.swift +++ b/ios/App/Shared/player/AudioPlayer.swift @@ -371,6 +371,10 @@ class AudioPlayer: NSObject { // Reconstruct queue if seeking to a different track if (self.currentTrackIndex != indexOfSeek) { + // When we seek to a different track, we need to make sure to seek the old track to 0 + // or we will get jumps to the old position when fading over into a new track + self.audioPlayer.seek(to: CMTime(seconds: 0, preferredTimescale: 1000)) + self.currentTrackIndex = indexOfSeek try? playbackSession.update {