AVPlayer seek completion handler not called

@AVFoundation Engineers, I get this bug repeatedly when using AVComposition & AVVideoComposition. Sometimes AVPlayer seek to time completion handler is not called. I check for a flag whether seek is in progress before placing another seek request. But if the completion handler is never invoked, all further seeks stall as flag remains true. What is a reliable way to know seek is not in progress before initiating another seek request.

      playerSeeking = true

        player.seek(to: time, toleranceBefore: .zero, toleranceAfter: .zero) { [weak self] completed 

            if !completed {
                NSLog("Seek not completed \(time.seconds)")
            }

            guard let self = self else {
                return
            }

            self.playerSeeking = false

            if self.player.rate == 0.0 {
                self.updateButtonStates()
            }
        }

That sounds like unexpected behavior to me. Please file a report using the feedback assistant.

@MediaEngineer. Filed bug FB9877123 with sample code with all info about reproducing, including demo video. As you might see in the sample code, the problem is not reproducible if you comment the following line in the code.

playerItem.seekingWaitsForVideoCompositionRendering = true

Please suggest appropriate workaround.

AVPlayer seek completion handler not called
 
 
Q