Latest 0.1.5
License MIT
Platforms ios 8.0

CI Status

Customizable Video Range Slider for trimming videos written in Swift 3.


Custom Indicators

Progress Indicator

Custom Time Labels


ABVideoRangeSlider is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "ABVideoRangeSlider"


To run the example project, clone the repo, and run pod install from the Example directory first.


  1. Insert an UIView in your Storyboard’s ViewController
  2. Change the class of your view to ‘ABVideoRangeSlider’
  3. Import ABVideoRangeSlider into your ViewController
  4. Control + Drag your UIView to create an IBOutlet in your ViewController
    @IBOutlet var videoRangeSlider: ABVideoRangeSlider!
  5. Add ABVideoRangeSliderDelegate to your controller
  6. Setup:
    // Set the video URL
    var path = Bundle.main.path(forResource: "myVideo", ofType:"mp4")
    videoRangeSlider.setVideoURL(videoURL: URL(fileURLWithPath: path!))

// Set the delegate
videoRangeSlider.delegate = self

// Set a minimun space (in seconds) between the Start indicator and End indicator
videoRangeSlider.minSpace = 60.0

// Set a maximun space (in seconds) between the Start indicator and End indicator – Default is 0 (no max limit)
videoRangeSlider.maxSpace = 120.0

``` Swift
// Set initial position of Start Indicator
videoRangeSlider.setStartPosition(seconds: 50.0)

// Set initial position of End Indicator
videoRangeSlider.setEndPosition(seconds: 150.0)

Progress indicator

You can show/hide this indicator using the following methods


If you want to update the position:

    videoRangeSlider.updateProgressIndicator(seconds: elapsedTimeOfVideo)

You can also have the progress indicator be "sticky" follow the start crop indicator when adjusted:

    videoRangeSlider.isProgressIndicatorSticky = true

Custom Time Labels

You can customize the time label’s backgrounds providing a custom UIView to videoRangeSlider.startTimeView.backgroundView.


  let customView = UIView(frame: CGRect(x: 0,
                                        y: 0,
                                        width: 60,
                                        height: 40))
  customView.backgroundColor = .black
  customView.alpha = 0.5
  customView.layer.borderColor =
  customView.layer.borderWidth = 1.0
  customView.layer.cornerRadius = 8.0
  videoRangeSlider.startTimeView.backgroundView = customView


  // Shows the formatted time
  timeLabel: UILabel

  // UILabel's margins - Default = 5.0
  marginTop: CGFloat     
  marginBottom: CGFloat   
  marginLeft: CGFloat      
  marginRight: CGFloat   

  // Background View
  backgroundView : UIView


func didChangeValue(videoRangeSlider: ABVideoRangeSlider, startTime: Float64, endTime: Float64) {
    print(startTime)    // Prints the position of the Start indicator in seconds
    print(endTime)      // Prints the position of the End indicator in seconds
func indicatorDidChangePosition(videoRangeSlider: ABVideoRangeSlider, position: Float64) {
    print(position)      // Prints the position of the Progress indicator in seconds


        // Customize the Start indicator with a custom image
        let customStartIndicator =  UIImage(named: "CustomStartIndicator")
        videoRangeSlider.setStartIndicatorImage(image: customStartIndicator!)

        // Customize the End indicator with a custom image
        let customEndIndicator =  UIImage(named: "CustomEndIndicator")
        videoRangeSlider.setEndIndicatorImage(image: customEndIndicator!)

        // Customize bottom and top border with a custom image
        let customBorder =  UIImage(named: "CustomBorder")
        videoRangeSlider.setBorderImage(image: customBorder!)

        // Customize Progress indicator with a custom image
        let customProgressIndicator =  UIImage(named: "CustomProgressIndicator")
        videoRangeSlider.setProgressIndicatorImage(image: customProgressIndicator!)

Public method

If you need to update the thumbnails of the video, you can call this method manually. (By default it’s called every time the view changes its bounds)



Apps Boulevard


ABVideoRangeSlider is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "ABVideoRangeSlider",
    "version": "0.1.5",
    "summary": "A simple range slider for trimming videos written in Swift 3. Includes a Progress Indicator.",
    "description": "Display thumbnails and a slider for trimming videos in iOS. Includes a Progress Indicator",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Oscar J. Irun": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.5"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source_files": [
    "resource_bundles": {
        "ABVideoRangeSlider": [
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This