GithubHelp home page GithubHelp logo

theome / prynttrimmerview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hhk1/prynttrimmerview

0.0 0.0 0.0 5.71 MB

A set of tools to trim, crop and select frames inside a video

License: MIT License

Swift 96.57% Ruby 2.50% Objective-C 0.93%

prynttrimmerview's Introduction

PryntTrimmerView

codebeat badge Platform License Version Carthage compatible

A set of tools written in swift to crop and trim videos.

Example

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

Trimming

Cropping

Requirements

PryntTrimmerView requires iOS9: It uses Layout Anchors to define the constraints.

Installation

CocoaPods

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

pod "PryntTrimmerView"

Then, run pod install to download the source and add it to your workspace.

Carthage

PryntTrimmmerView is available through Carthage. To install it, simply add the following line to your Cartfile:

github "HHK1/PryntTrimmerView"

Run carthage update to build the framework and drag the built PryntTrimmerView.framework into your Xcode project.

Swift Version

  • Swift 3 compatibility: use version 1.0.1 or below.
  • Swift 4 compatibility: use version 2.x.x.
  • Swift 4.2 compatibility: use version 3.x.x

Usage

โš ๏ธ This library does not contain an API to crop or trim your video asset. You can find a possible implementation for this in the example pod, but the library only provides the UI.

Trimming

Create a TrimmerView instance (in interface builder or through code), and add it to your view hierarchy.

trimmerView.asset = asset
trimmerView.delegate = self

Access the startTime and endTime property to know where to trim your asset. You can use the TrimmerViewDelegate to link the trimmer with an AVPlayer and provide the end user with a preview. See the VideoTrimmerViewController inside the project to see an example.

You can also customize the trimmer view by changing its colors:

trimmerView.handleColor = UIColor.white
trimmerView.mainColor = UIColor.orange
trimmerView.positionBarColor = UIColor.white

Cropping

Create an instance of the VideoCropView and add it to your view hierarchy, then load your video into the crop view: videoCropView.asset = asset.

You can set the aspect ratio you want using the setAspectRatio method. Once you are satisfied with the portion of the asset you want to crop, call getImageCropFrame to retrieve the select frame. See the VideoCropperViewController in the example app for an actual example of how to crop the video for export.

License

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

prynttrimmerview's People

Contributors

hhk1 avatar theome avatar rvi avatar s4cha avatar sparga 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.