I have an audio player in app. And a slider to move the audio track. But, for example, in my app on the lock screen, the slider does not freezing when I scroll it from left to right. And it doesn't try to play audio while rewinding. When I clamp it, it continues to play audio, and it starts playing a new time only after releasing the slider. The slider works fine like in Apple Music app.
And inside my app there is also a slider and it freezes when I scroll it. And the larger the size of the audio file, the more the slider freezes when scrolling. That is, if I move it from the beginning of the track to the end, then along the way it clings to pieces of the audio track and tries to play them. And does not move smoothly like on a locked screen. How to fix it?
@IBAction func slide(_ slider: UISlider) {
musicOperation.cancelAllOperations()
let operation = BlockOperation()
audioPlayer.currentTime = TimeInterval(slider.value)
musicOperation.addOperation(operation)
}