Skip to content

Tomohiro-Yamashita/VideoTimelineView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 

Repository files navigation

VideoTimelineView

Video timeline UI for iOS Apps

  • Zoom in/out with pinch
  • Scrub with sound
  • Repeat playing in the trimmer

screenshot

Usage

Copy the VideoTimelineView folder in this project to yours

  • To setup

    let videoTimelineView = VideoTimelineView()
    videoTimelineView.frame = timelineRect
    videoTimelineView.new(asset:AVAsset(url:videoURL))
    view.addSubview(videoTimelineView)
    
  • To get actions from VideoTimelineView Add TimelinePlayStatusReceiver protocol in your ViewController

    class ViewController: UIViewController, TimelinePlayStatusReceiver {
    

    And set viewController as receiver

    videoTimelineView.playStatusReceiver = self
    
  • Get actions Implement these functions in your viewController

    func videoTimelineStopped()
    func videoTimelineMoved()
    func videoTimelineTrimChanged()
    

    To get values of the trimmer

    let trim = videoTimelineView.currentTrim()
    print("start time: \(trim.start)")
    print("end time: \(trim.end)")
    
  • To control

     //Repeat in the trimmer
    videoTimelineView.repeatOn = true
    
     //If set in false, the trimmer will be ignored
    videoTimelineView.setTrimIsEnabled(true)
    
     //Hide trimmer
    videoTimelineView.setTrimmerIsHidden(true)
    
     //Go to 0s with animation
    videoTimelineView.moveTo(0, animate:true)
    
     //Set trimmer from 5 to 10 with animation and move to 3
    videoTimelineView.setTrim(start:5, end:10, seek:3, animate:true)
    

Example Product

The app with VideoTimeLlineView on the AppStore(Free).

License

MIT

Contact

E-mail, twitter, Facebook