VideoTrim 0.1.7

VideoTrim 0.1.7

Maintained by ‘pikachu987’.



VideoTrim 0.1.7

  • By
  • pikachu987

VideoTrim

CI Status Version License Platform Swift 5.0

Introduce

You can extract an image for each video frame as a video asset and set the start time and end time.


VideoTrim

- -

Requirements

VideoTrim written in Swift 5.0. Compatible with iOS 8.0+

Installation

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

pod 'VideoTrim'

Usage

import VideoTrim
let videoTrim = VideoTrim()
self.view.addSubview(videoTrim)

done!


Property

Set Property

asset

videoTrim.asset = AVAsset(url: url) // After setting the asset, the image frame is extracted.

videoTrim.currentTime = CMTime(value: 0, timescale: 0) // The frame bar position changes with currentTime.
videoTrim.frameImageCount = 20 // Number of frame images
videoTrim.trimReaminWidth = 50 // Video trim minimum length
videoTrim.trimMaximumDuration = CMTime(value: CMTimeValue(6000), timescale: CMTimeScale(600)) // Video trim maximum Time

videoTrim.topMargin = 4 // The top margin of the screen.
videoTrim.bottomMargin = 8 // The bottom margin of the screen.
videoTrim.leadingMargin = 0 // The leading margin of the screen.
videoTrim.trailingMargin = 0 // The trailing margin of the screen.

videoTrim.frameHeight = 48 // The image frame height.

videoTrim.trimMaskDimViewColor = UIColor(white: 0/255, alpha: 0.7) // The color of the screen overlay outside the start time and end time.
videoTrim.trimLineRadius = 4 // The radius of the trim line.
videoTrim.trimLineWidth = 4 // Border width of the trim line.
videoTrim.trimLineViewColor = UIColor.white.cgColor // This is the trim line color.

videoTrim.playLineRadius = 3 // The radius of the play line.
videoTrim.playLineWidth = 6 // This is the border width of the play line.
videoTrim.playLineVerticalSize = 4 // The difference between the height of the play line and the top and bottom of the image frame.
videoTrim.playTimeLineViewColor = UIColor.white // This is the play time line color.

videoTrim.timeColor = UIColor.white // time text color.
videoTrim.timeFont = UIFont.systemFont(ofSize: 15) // time text font.

videoTrim.startTime = CMTime(value: 600, timescale: 600) // CMTime of start time.
videoTrim.endTime = CMTime(value: 1200, timescale: 600) // CMTime of end time.
videoTrim.durationTime = CMTime(value: 1200, timescale: 600) // CMTime from start time to end time.

Get Property

videoTrim.playTime // CMTime of PlayTime.
videoTrim.startTime // CMTime of start time.
videoTrim.endTime // CMTime of end time.
videoTrim.durationTime // CMTime from start time to end time.

Delegate

class ViewController: UIViewController{
    override func viewDidLoad() {
        super.viewDidLoad()

        let videoTrim = VideoTrim()
        videoTrim.delegate = self
    }
}

// MARK: VideoTrimDelegate
extension ViewController: VideoTrimDelegate {
    func videoTrimStartTrimChange(_ videoTrim: VideoTrim) { // It is called when you touch the start time, end time, and play time.
        
    }

    func videoTrimEndTrimChange(_ videoTrim: VideoTrim) { // Called at the end of touch start time, end time and play time.
        
    }

    func videoTrimPlayTimeChange(_ videoTrim: VideoTrim) { // Called when touching the start time, end time and play time.
        
    }
}

Author

pikachu987, [email protected]

License

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