Closed defagos closed 3 years ago
Seek is sharp for
[self presentViewController:playerViewController animated:YES completion:^{
[player seekToTime:CMTimeMakeWithSeconds(219., NSEC_PER_SEC) toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero completionHandler:^(BOOL finished) {
[player play];
}];
}];
but jumps to 212, even for small tolerances:
[self presentViewController:playerViewController animated:YES completion:^{
[player seekToTime:CMTimeMakeWithSeconds(219., NSEC_PER_SEC) toleranceBefore:CMTimeMakeWithSeconds(0.1, NSEC_PER_SEC) toleranceAfter:kCMTimeZero completionHandler:^(BOOL finished) {
[player play];
}];
}];
What is puzzling me is that playback also starts at 212 if we set a small tolerance after:
[self presentViewController:playerViewController animated:YES completion:^{
[player seekToTime:CMTimeMakeWithSeconds(219., NSEC_PER_SEC) toleranceBefore:kCMTimeZero toleranceAfter:CMTimeMakeWithSeconds(0.1, NSEC_PER_SEC) completionHandler:^(BOOL finished) {
[player play];
}];
}];
I fixed related unit tests (and ensured they break with the current behavior, highlighting the issue). This is available on the feature/imprecise-seeks
branch.
Still waiting for an answer from Apple.
Not fixed in iOS 12.1.
Still not fixed in iOS 13.5.
Fixed as of iOS 14. I closed my radar accordingly.
For some tolerance settings and start position, and depending on where the time to seek to is located within a chunk, tolerance settings are not correctly applied, and playback might start outside the tolerated range.
This issue is an
AVPlayer
issue or limitation, or there is something I did not correctly understand with-seekToTime:toleranceBefore:toleranceAfter:completionHandler:
:Playback would in this case be expected to start in
[216, inf]
, but will actually start at the beginning of the chunk near 212.