Instantly share code, notes, and snippets.
Hi Gavin, this AVPlayer tutorial is the most elegant and brief solution that I found in goole. I added a function call "avPlayer.seekToTime(CMTimeMakeWithSeconds(elapsedTime, 10))" in func sliderValueChanged(slider: UISlider!) to update the video screen when user dragged the slider. Here is the github link https://github.com/Charles-Hsu/CustomVideoPlayer.
Thanks for the compliment Charles (for those that didn't come here via the article - Charles is referring to this).
Just a word of caution on adding the method invocation you suggest: Attempting to seek inside sliderValueChanged saturates the AVPlayer in network dependent seek requests and as such can significantly degrade the user experience in the case where the video is being streamed.