Giter VIP home page Giter VIP logo

videotrim's Introduction

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 9.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.

videotrim's People

Contributors

doganaltinbas avatar pikachu987 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.