I am using Player library, that is using AVPlayer & AVFoundation, which is quiet convenient for my case. I successfully managed to play the video and add a slider. I set the
It is preferable from an UX point of view to call the seek()
method on your Player
after a touchUp
on your slider, rather than whenever the value changes.
As you noticed, you had poor experience with the sliderValueDidChange
.
Instead, try by adding a target/action on UIControlEvents.TouchUpInside (for instance) on your slider, then only seek. The experience should be better.
var slider : UISlider! { didSet { slider.addTarget(self, action: Selector("touchUp:"), forControlEvents: [UIControlEvents.TouchUpInside]) } } func touchUp(sender:AnyObject?) { // player.seek(slider.currentValue) }