ModernAVPlayer
ModernAVPlayer copied to clipboard
Precise seek missing
Sometimes there are cases where you need precise seeking which is called like this
player.seek(to: CMTime(seconds: 100, preferredTimescale: CMTimeScale(NSEC_PER_SEC)), toleranceBefore: .zero, toleranceAfter: .zero)
currently seeking is not precise which is fine in most cases, however it would be nice to have precise seek
proposed solution extend current seek methods with another one with additional parameter isPrecise
or isAccurate
to not introduce breaking changes, example:
existing:
public func seek(position: Double) {
context.seek(position: position, isPrecise: false)
}
new:
public func seek(position: Double, isPrecise: Bool) {
context.seek(position: position, isPrecise: isPrecise)
}
would you approve this type of PR if I do? @raphrel
sure, I'm always open for PR ! thanks
what do you think of this instead:
public func seek(position: Double, tolerance: CMTime) {
context.seek(position: position, tolerance: tolerance)
}
If you want to go with CMTime parameters in api, I would rather replicate apple's api with toleranceBefore and toleranceAfter, but to simplify api and abstract more from AVFoundation isAccurate parameters looks better to me being clear to understand(can be explained in docs in addition)