├── .gitignore ├── .travis.yml ├── Example ├── Podfile ├── Podfile.lock ├── Tests │ ├── Info.plist │ └── Tests.swift ├── YiVideoEditor.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── YiVideoEditor-Example.xcscheme ├── YiVideoEditor.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── YiVideoEditor │ ├── AppDelegate.swift │ ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard │ ├── HomeViewController.swift │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── VideoViewController.swift │ ├── YiVideoEditor_Example-Bridging-Header.h │ ├── applause-01.mp3 │ ├── cancel.png │ ├── cancel@2x.png │ └── cancel@3x.png ├── LICENSE ├── README.md ├── YiVideoEditor.podspec ├── YiVideoEditor ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── Commands │ ├── YiAddAudioCommand.swift │ ├── YiAddLayerCommand.swift │ ├── YiCropCommand.swift │ └── YiRotateCommand.swift │ ├── YiVideoEditor.swift │ └── YiVideoEditorData.swift └── _Pods.xcodeproj /.gitignore: -------------------------------------------------------------------------------- 1 | # macOS 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 26 | # Carthage/Checkouts 27 | 28 | Carthage/Build 29 | 30 | # We recommend against adding the Pods directory to your .gitignore. However 31 | # you should judge for yourself, the pros and cons are mentioned at: 32 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 33 | # 34 | # Note: if you ignore the Pods directory, make sure to uncomment 35 | # `pod install` in .travis.yml 36 | # 37 | Example/Pods/ 38 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * https://www.objc.io/issues/6-build-tools/travis-ci/ 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/YiVideoEditor.xcworkspace -scheme YiVideoEditor-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | platform :ios, '9.0' 4 | 5 | target 'YiVideoEditor_Example' do 6 | pod 'YiVideoEditor', :path => '../' 7 | pod 'LLSimpleCamera', '~> 3.0' 8 | 9 | target 'YiVideoEditor_Tests' do 10 | inherit! :search_paths 11 | 12 | 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - LLSimpleCamera (3.0.0) 3 | - YiVideoEditor (0.1.0) 4 | 5 | DEPENDENCIES: 6 | - LLSimpleCamera (~> 3.0) 7 | - YiVideoEditor (from `../`) 8 | 9 | SPEC REPOS: 10 | trunk: 11 | - LLSimpleCamera 12 | 13 | EXTERNAL SOURCES: 14 | YiVideoEditor: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | LLSimpleCamera: 3c41b46917f9ca53b91ef9c0cf24a75ce0ab4cd8 19 | YiVideoEditor: f14e190cf8c56e97be783cd8076d295e41059e7c 20 | 21 | PODFILE CHECKSUM: c299f052f68ba87cc0afeb1b89121ec37dd85c59 22 | 23 | COCOAPODS: 1.10.0 24 | -------------------------------------------------------------------------------- /Example/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import YiVideoEditor 3 | 4 | class Tests: XCTestCase { 5 | 6 | override func setUp() { 7 | super.setUp() 8 | // Put setup code here. This method is called before the invocation of each test method in the class. 9 | } 10 | 11 | override func tearDown() { 12 | // Put teardown code here. This method is called after the invocation of each test method in the class. 13 | super.tearDown() 14 | } 15 | 16 | func testExample() { 17 | // This is an example of a functional test case. 18 | XCTAssert(true, "Pass") 19 | } 20 | 21 | func testPerformanceExample() { 22 | // This is an example of a performance test case. 23 | self.measure() { 24 | // Put the code you want to measure the time of here. 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Example/YiVideoEditor.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 002C5ECA270B5242003E0924 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 002C5EC9270B5242003E0924 /* HomeViewController.swift */; }; 11 | 002C5ECE270B524B003E0924 /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 002C5ECD270B524B003E0924 /* VideoViewController.swift */; }; 12 | 00F1CD0B270C515C00D90600 /* applause-01.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 00F1CD07270C515C00D90600 /* applause-01.mp3 */; }; 13 | 00F1CD0C270C515C00D90600 /* cancel@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 00F1CD08270C515C00D90600 /* cancel@3x.png */; }; 14 | 00F1CD0D270C515C00D90600 /* cancel@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 00F1CD09270C515C00D90600 /* cancel@2x.png */; }; 15 | 00F1CD0E270C515C00D90600 /* cancel.png in Resources */ = {isa = PBXBuildFile; fileRef = 00F1CD0A270C515C00D90600 /* cancel.png */; }; 16 | 1760291CFEC8A48BDB677092 /* Pods_YiVideoEditor_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 685CD6277508152D17CAAC6E /* Pods_YiVideoEditor_Tests.framework */; }; 17 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 18 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 19 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 20 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 21 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 22 | 659E9F06841EB63CE85802A6 /* Pods_YiVideoEditor_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36853FEAFDC4F8C5D586CF56 /* Pods_YiVideoEditor_Example.framework */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 607FACCF1AFB9204008FA782; 31 | remoteInfo = YiVideoEditor; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 002C5EC9270B5242003E0924 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; 37 | 002C5ECD270B524B003E0924 /* VideoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = ""; }; 38 | 002C5EDC270C27CD003E0924 /* YiVideoEditor_Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YiVideoEditor_Example-Bridging-Header.h"; sourceTree = ""; }; 39 | 00F1CD07270C515C00D90600 /* applause-01.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "applause-01.mp3"; sourceTree = ""; }; 40 | 00F1CD08270C515C00D90600 /* cancel@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cancel@3x.png"; sourceTree = ""; }; 41 | 00F1CD09270C515C00D90600 /* cancel@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cancel@2x.png"; sourceTree = ""; }; 42 | 00F1CD0A270C515C00D90600 /* cancel.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cancel.png; sourceTree = ""; }; 43 | 2755DDEE45901803638FAB63 /* YiVideoEditor.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = YiVideoEditor.podspec; path = ../YiVideoEditor.podspec; sourceTree = ""; }; 44 | 30E14BC8DC932C561AFF86F1 /* Pods-YiVideoEditor_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YiVideoEditor_Tests.debug.xcconfig"; path = "Target Support Files/Pods-YiVideoEditor_Tests/Pods-YiVideoEditor_Tests.debug.xcconfig"; sourceTree = ""; }; 45 | 36853FEAFDC4F8C5D586CF56 /* Pods_YiVideoEditor_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YiVideoEditor_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 3CFFA174F89FF4F53F66AA9D /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 47 | 457477374821C46CD4F05920 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 48 | 50475F376FD7B92F8696644E /* Pods-YiVideoEditor_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YiVideoEditor_Example.debug.xcconfig"; path = "Target Support Files/Pods-YiVideoEditor_Example/Pods-YiVideoEditor_Example.debug.xcconfig"; sourceTree = ""; }; 49 | 607FACD01AFB9204008FA782 /* YiVideoEditor_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YiVideoEditor_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 52 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 54 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 55 | 607FACE51AFB9204008FA782 /* YiVideoEditor_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = YiVideoEditor_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 58 | 685CD6277508152D17CAAC6E /* Pods_YiVideoEditor_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_YiVideoEditor_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 9AE6E9CD84D5187C9EB85629 /* Pods-YiVideoEditor_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YiVideoEditor_Tests.release.xcconfig"; path = "Target Support Files/Pods-YiVideoEditor_Tests/Pods-YiVideoEditor_Tests.release.xcconfig"; sourceTree = ""; }; 60 | E968289DA9D0685510A2A115 /* Pods-YiVideoEditor_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-YiVideoEditor_Example.release.xcconfig"; path = "Target Support Files/Pods-YiVideoEditor_Example/Pods-YiVideoEditor_Example.release.xcconfig"; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 659E9F06841EB63CE85802A6 /* Pods_YiVideoEditor_Example.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | 1760291CFEC8A48BDB677092 /* Pods_YiVideoEditor_Tests.framework in Frameworks */, 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 607FACC71AFB9204008FA782 = { 84 | isa = PBXGroup; 85 | children = ( 86 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 87 | 607FACD21AFB9204008FA782 /* Example for YiVideoEditor */, 88 | 607FACE81AFB9204008FA782 /* Tests */, 89 | 607FACD11AFB9204008FA782 /* Products */, 90 | C9AD36E294F268B9591028BC /* Pods */, 91 | A1440250219D1C5BFF00FD94 /* Frameworks */, 92 | ); 93 | sourceTree = ""; 94 | }; 95 | 607FACD11AFB9204008FA782 /* Products */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 607FACD01AFB9204008FA782 /* YiVideoEditor_Example.app */, 99 | 607FACE51AFB9204008FA782 /* YiVideoEditor_Tests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 607FACD21AFB9204008FA782 /* Example for YiVideoEditor */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 00F1CD07270C515C00D90600 /* applause-01.mp3 */, 108 | 00F1CD0A270C515C00D90600 /* cancel.png */, 109 | 00F1CD09270C515C00D90600 /* cancel@2x.png */, 110 | 00F1CD08270C515C00D90600 /* cancel@3x.png */, 111 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 112 | 002C5EC9270B5242003E0924 /* HomeViewController.swift */, 113 | 002C5ECD270B524B003E0924 /* VideoViewController.swift */, 114 | 607FACD91AFB9204008FA782 /* Main.storyboard */, 115 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 116 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 117 | 607FACD31AFB9204008FA782 /* Supporting Files */, 118 | 002C5EDC270C27CD003E0924 /* YiVideoEditor_Example-Bridging-Header.h */, 119 | ); 120 | name = "Example for YiVideoEditor"; 121 | path = YiVideoEditor; 122 | sourceTree = ""; 123 | }; 124 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 607FACD41AFB9204008FA782 /* Info.plist */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | 607FACE81AFB9204008FA782 /* Tests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 607FACEB1AFB9204008FA782 /* Tests.swift */, 136 | 607FACE91AFB9204008FA782 /* Supporting Files */, 137 | ); 138 | path = Tests; 139 | sourceTree = ""; 140 | }; 141 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 607FACEA1AFB9204008FA782 /* Info.plist */, 145 | ); 146 | name = "Supporting Files"; 147 | sourceTree = ""; 148 | }; 149 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 150 | isa = PBXGroup; 151 | children = ( 152 | 2755DDEE45901803638FAB63 /* YiVideoEditor.podspec */, 153 | 3CFFA174F89FF4F53F66AA9D /* README.md */, 154 | 457477374821C46CD4F05920 /* LICENSE */, 155 | ); 156 | name = "Podspec Metadata"; 157 | sourceTree = ""; 158 | }; 159 | A1440250219D1C5BFF00FD94 /* Frameworks */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 36853FEAFDC4F8C5D586CF56 /* Pods_YiVideoEditor_Example.framework */, 163 | 685CD6277508152D17CAAC6E /* Pods_YiVideoEditor_Tests.framework */, 164 | ); 165 | name = Frameworks; 166 | sourceTree = ""; 167 | }; 168 | C9AD36E294F268B9591028BC /* Pods */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 50475F376FD7B92F8696644E /* Pods-YiVideoEditor_Example.debug.xcconfig */, 172 | E968289DA9D0685510A2A115 /* Pods-YiVideoEditor_Example.release.xcconfig */, 173 | 30E14BC8DC932C561AFF86F1 /* Pods-YiVideoEditor_Tests.debug.xcconfig */, 174 | 9AE6E9CD84D5187C9EB85629 /* Pods-YiVideoEditor_Tests.release.xcconfig */, 175 | ); 176 | path = Pods; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXGroup section */ 180 | 181 | /* Begin PBXNativeTarget section */ 182 | 607FACCF1AFB9204008FA782 /* YiVideoEditor_Example */ = { 183 | isa = PBXNativeTarget; 184 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "YiVideoEditor_Example" */; 185 | buildPhases = ( 186 | 52F68CC12BB6DBF11A2246D5 /* [CP] Check Pods Manifest.lock */, 187 | 607FACCC1AFB9204008FA782 /* Sources */, 188 | 607FACCD1AFB9204008FA782 /* Frameworks */, 189 | 607FACCE1AFB9204008FA782 /* Resources */, 190 | 25ACE816A1959C8BD9F9CB51 /* [CP] Embed Pods Frameworks */, 191 | ); 192 | buildRules = ( 193 | ); 194 | dependencies = ( 195 | ); 196 | name = YiVideoEditor_Example; 197 | productName = YiVideoEditor; 198 | productReference = 607FACD01AFB9204008FA782 /* YiVideoEditor_Example.app */; 199 | productType = "com.apple.product-type.application"; 200 | }; 201 | 607FACE41AFB9204008FA782 /* YiVideoEditor_Tests */ = { 202 | isa = PBXNativeTarget; 203 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "YiVideoEditor_Tests" */; 204 | buildPhases = ( 205 | 814C1D2B2D7031F92613464C /* [CP] Check Pods Manifest.lock */, 206 | 607FACE11AFB9204008FA782 /* Sources */, 207 | 607FACE21AFB9204008FA782 /* Frameworks */, 208 | 607FACE31AFB9204008FA782 /* Resources */, 209 | ); 210 | buildRules = ( 211 | ); 212 | dependencies = ( 213 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */, 214 | ); 215 | name = YiVideoEditor_Tests; 216 | productName = Tests; 217 | productReference = 607FACE51AFB9204008FA782 /* YiVideoEditor_Tests.xctest */; 218 | productType = "com.apple.product-type.bundle.unit-test"; 219 | }; 220 | /* End PBXNativeTarget section */ 221 | 222 | /* Begin PBXProject section */ 223 | 607FACC81AFB9204008FA782 /* Project object */ = { 224 | isa = PBXProject; 225 | attributes = { 226 | LastSwiftUpdateCheck = 0830; 227 | LastUpgradeCheck = 0830; 228 | ORGANIZATIONNAME = CocoaPods; 229 | TargetAttributes = { 230 | 607FACCF1AFB9204008FA782 = { 231 | CreatedOnToolsVersion = 6.3.1; 232 | LastSwiftMigration = 1210; 233 | }; 234 | 607FACE41AFB9204008FA782 = { 235 | CreatedOnToolsVersion = 6.3.1; 236 | LastSwiftMigration = 0900; 237 | TestTargetID = 607FACCF1AFB9204008FA782; 238 | }; 239 | }; 240 | }; 241 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "YiVideoEditor" */; 242 | compatibilityVersion = "Xcode 3.2"; 243 | developmentRegion = English; 244 | hasScannedForEncodings = 0; 245 | knownRegions = ( 246 | English, 247 | en, 248 | Base, 249 | ); 250 | mainGroup = 607FACC71AFB9204008FA782; 251 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 252 | projectDirPath = ""; 253 | projectRoot = ""; 254 | targets = ( 255 | 607FACCF1AFB9204008FA782 /* YiVideoEditor_Example */, 256 | 607FACE41AFB9204008FA782 /* YiVideoEditor_Tests */, 257 | ); 258 | }; 259 | /* End PBXProject section */ 260 | 261 | /* Begin PBXResourcesBuildPhase section */ 262 | 607FACCE1AFB9204008FA782 /* Resources */ = { 263 | isa = PBXResourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | 00F1CD0C270C515C00D90600 /* cancel@3x.png in Resources */, 267 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 268 | 00F1CD0E270C515C00D90600 /* cancel.png in Resources */, 269 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 270 | 00F1CD0B270C515C00D90600 /* applause-01.mp3 in Resources */, 271 | 00F1CD0D270C515C00D90600 /* cancel@2x.png in Resources */, 272 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 607FACE31AFB9204008FA782 /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXResourcesBuildPhase section */ 284 | 285 | /* Begin PBXShellScriptBuildPhase section */ 286 | 25ACE816A1959C8BD9F9CB51 /* [CP] Embed Pods Frameworks */ = { 287 | isa = PBXShellScriptBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | ); 291 | inputPaths = ( 292 | "${PODS_ROOT}/Target Support Files/Pods-YiVideoEditor_Example/Pods-YiVideoEditor_Example-frameworks.sh", 293 | "${BUILT_PRODUCTS_DIR}/LLSimpleCamera/LLSimpleCamera.framework", 294 | "${BUILT_PRODUCTS_DIR}/YiVideoEditor/YiVideoEditor.framework", 295 | ); 296 | name = "[CP] Embed Pods Frameworks"; 297 | outputPaths = ( 298 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LLSimpleCamera.framework", 299 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YiVideoEditor.framework", 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | shellPath = /bin/sh; 303 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-YiVideoEditor_Example/Pods-YiVideoEditor_Example-frameworks.sh\"\n"; 304 | showEnvVarsInLog = 0; 305 | }; 306 | 52F68CC12BB6DBF11A2246D5 /* [CP] Check Pods Manifest.lock */ = { 307 | isa = PBXShellScriptBuildPhase; 308 | buildActionMask = 2147483647; 309 | files = ( 310 | ); 311 | inputFileListPaths = ( 312 | ); 313 | inputPaths = ( 314 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 315 | "${PODS_ROOT}/Manifest.lock", 316 | ); 317 | name = "[CP] Check Pods Manifest.lock"; 318 | outputFileListPaths = ( 319 | ); 320 | outputPaths = ( 321 | "$(DERIVED_FILE_DIR)/Pods-YiVideoEditor_Example-checkManifestLockResult.txt", 322 | ); 323 | runOnlyForDeploymentPostprocessing = 0; 324 | shellPath = /bin/sh; 325 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 326 | showEnvVarsInLog = 0; 327 | }; 328 | 814C1D2B2D7031F92613464C /* [CP] Check Pods Manifest.lock */ = { 329 | isa = PBXShellScriptBuildPhase; 330 | buildActionMask = 2147483647; 331 | files = ( 332 | ); 333 | inputFileListPaths = ( 334 | ); 335 | inputPaths = ( 336 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 337 | "${PODS_ROOT}/Manifest.lock", 338 | ); 339 | name = "[CP] Check Pods Manifest.lock"; 340 | outputFileListPaths = ( 341 | ); 342 | outputPaths = ( 343 | "$(DERIVED_FILE_DIR)/Pods-YiVideoEditor_Tests-checkManifestLockResult.txt", 344 | ); 345 | runOnlyForDeploymentPostprocessing = 0; 346 | shellPath = /bin/sh; 347 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 348 | showEnvVarsInLog = 0; 349 | }; 350 | /* End PBXShellScriptBuildPhase section */ 351 | 352 | /* Begin PBXSourcesBuildPhase section */ 353 | 607FACCC1AFB9204008FA782 /* Sources */ = { 354 | isa = PBXSourcesBuildPhase; 355 | buildActionMask = 2147483647; 356 | files = ( 357 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 358 | 002C5ECE270B524B003E0924 /* VideoViewController.swift in Sources */, 359 | 002C5ECA270B5242003E0924 /* HomeViewController.swift in Sources */, 360 | ); 361 | runOnlyForDeploymentPostprocessing = 0; 362 | }; 363 | 607FACE11AFB9204008FA782 /* Sources */ = { 364 | isa = PBXSourcesBuildPhase; 365 | buildActionMask = 2147483647; 366 | files = ( 367 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, 368 | ); 369 | runOnlyForDeploymentPostprocessing = 0; 370 | }; 371 | /* End PBXSourcesBuildPhase section */ 372 | 373 | /* Begin PBXTargetDependency section */ 374 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { 375 | isa = PBXTargetDependency; 376 | target = 607FACCF1AFB9204008FA782 /* YiVideoEditor_Example */; 377 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; 378 | }; 379 | /* End PBXTargetDependency section */ 380 | 381 | /* Begin PBXVariantGroup section */ 382 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = { 383 | isa = PBXVariantGroup; 384 | children = ( 385 | 607FACDA1AFB9204008FA782 /* Base */, 386 | ); 387 | name = Main.storyboard; 388 | sourceTree = ""; 389 | }; 390 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 391 | isa = PBXVariantGroup; 392 | children = ( 393 | 607FACDF1AFB9204008FA782 /* Base */, 394 | ); 395 | name = LaunchScreen.xib; 396 | sourceTree = ""; 397 | }; 398 | /* End PBXVariantGroup section */ 399 | 400 | /* Begin XCBuildConfiguration section */ 401 | 607FACED1AFB9204008FA782 /* Debug */ = { 402 | isa = XCBuildConfiguration; 403 | buildSettings = { 404 | ALWAYS_SEARCH_USER_PATHS = NO; 405 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 406 | CLANG_CXX_LIBRARY = "libc++"; 407 | CLANG_ENABLE_MODULES = YES; 408 | CLANG_ENABLE_OBJC_ARC = YES; 409 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 410 | CLANG_WARN_BOOL_CONVERSION = YES; 411 | CLANG_WARN_COMMA = YES; 412 | CLANG_WARN_CONSTANT_CONVERSION = YES; 413 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 414 | CLANG_WARN_EMPTY_BODY = YES; 415 | CLANG_WARN_ENUM_CONVERSION = YES; 416 | CLANG_WARN_INFINITE_RECURSION = YES; 417 | CLANG_WARN_INT_CONVERSION = YES; 418 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 422 | CLANG_WARN_STRICT_PROTOTYPES = YES; 423 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 424 | CLANG_WARN_UNREACHABLE_CODE = YES; 425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 427 | COPY_PHASE_STRIP = NO; 428 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 429 | ENABLE_STRICT_OBJC_MSGSEND = YES; 430 | ENABLE_TESTABILITY = YES; 431 | GCC_C_LANGUAGE_STANDARD = gnu99; 432 | GCC_DYNAMIC_NO_PIC = NO; 433 | GCC_NO_COMMON_BLOCKS = YES; 434 | GCC_OPTIMIZATION_LEVEL = 0; 435 | GCC_PREPROCESSOR_DEFINITIONS = ( 436 | "DEBUG=1", 437 | "$(inherited)", 438 | ); 439 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 440 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 441 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 442 | GCC_WARN_UNDECLARED_SELECTOR = YES; 443 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 444 | GCC_WARN_UNUSED_FUNCTION = YES; 445 | GCC_WARN_UNUSED_VARIABLE = YES; 446 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 447 | MTL_ENABLE_DEBUG_INFO = YES; 448 | ONLY_ACTIVE_ARCH = YES; 449 | SDKROOT = iphoneos; 450 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 451 | }; 452 | name = Debug; 453 | }; 454 | 607FACEE1AFB9204008FA782 /* Release */ = { 455 | isa = XCBuildConfiguration; 456 | buildSettings = { 457 | ALWAYS_SEARCH_USER_PATHS = NO; 458 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 459 | CLANG_CXX_LIBRARY = "libc++"; 460 | CLANG_ENABLE_MODULES = YES; 461 | CLANG_ENABLE_OBJC_ARC = YES; 462 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 463 | CLANG_WARN_BOOL_CONVERSION = YES; 464 | CLANG_WARN_COMMA = YES; 465 | CLANG_WARN_CONSTANT_CONVERSION = YES; 466 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 467 | CLANG_WARN_EMPTY_BODY = YES; 468 | CLANG_WARN_ENUM_CONVERSION = YES; 469 | CLANG_WARN_INFINITE_RECURSION = YES; 470 | CLANG_WARN_INT_CONVERSION = YES; 471 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 472 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 473 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 474 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 475 | CLANG_WARN_STRICT_PROTOTYPES = YES; 476 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 477 | CLANG_WARN_UNREACHABLE_CODE = YES; 478 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 479 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 480 | COPY_PHASE_STRIP = NO; 481 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 482 | ENABLE_NS_ASSERTIONS = NO; 483 | ENABLE_STRICT_OBJC_MSGSEND = YES; 484 | GCC_C_LANGUAGE_STANDARD = gnu99; 485 | GCC_NO_COMMON_BLOCKS = YES; 486 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 487 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 488 | GCC_WARN_UNDECLARED_SELECTOR = YES; 489 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 490 | GCC_WARN_UNUSED_FUNCTION = YES; 491 | GCC_WARN_UNUSED_VARIABLE = YES; 492 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 493 | MTL_ENABLE_DEBUG_INFO = NO; 494 | SDKROOT = iphoneos; 495 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 496 | VALIDATE_PRODUCT = YES; 497 | }; 498 | name = Release; 499 | }; 500 | 607FACF01AFB9204008FA782 /* Debug */ = { 501 | isa = XCBuildConfiguration; 502 | baseConfigurationReference = 50475F376FD7B92F8696644E /* Pods-YiVideoEditor_Example.debug.xcconfig */; 503 | buildSettings = { 504 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 505 | CLANG_ENABLE_MODULES = YES; 506 | INFOPLIST_FILE = YiVideoEditor/Info.plist; 507 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 508 | MODULE_NAME = ExampleApp; 509 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 510 | PRODUCT_NAME = "$(TARGET_NAME)"; 511 | SWIFT_OBJC_BRIDGING_HEADER = "YiVideoEditor/YiVideoEditor_Example-Bridging-Header.h"; 512 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 513 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 514 | SWIFT_VERSION = 4.0; 515 | }; 516 | name = Debug; 517 | }; 518 | 607FACF11AFB9204008FA782 /* Release */ = { 519 | isa = XCBuildConfiguration; 520 | baseConfigurationReference = E968289DA9D0685510A2A115 /* Pods-YiVideoEditor_Example.release.xcconfig */; 521 | buildSettings = { 522 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 523 | CLANG_ENABLE_MODULES = YES; 524 | INFOPLIST_FILE = YiVideoEditor/Info.plist; 525 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 526 | MODULE_NAME = ExampleApp; 527 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | SWIFT_OBJC_BRIDGING_HEADER = "YiVideoEditor/YiVideoEditor_Example-Bridging-Header.h"; 530 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 531 | SWIFT_VERSION = 4.0; 532 | }; 533 | name = Release; 534 | }; 535 | 607FACF31AFB9204008FA782 /* Debug */ = { 536 | isa = XCBuildConfiguration; 537 | baseConfigurationReference = 30E14BC8DC932C561AFF86F1 /* Pods-YiVideoEditor_Tests.debug.xcconfig */; 538 | buildSettings = { 539 | FRAMEWORK_SEARCH_PATHS = ( 540 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 541 | "$(inherited)", 542 | ); 543 | GCC_PREPROCESSOR_DEFINITIONS = ( 544 | "DEBUG=1", 545 | "$(inherited)", 546 | ); 547 | INFOPLIST_FILE = Tests/Info.plist; 548 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 549 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 550 | PRODUCT_NAME = "$(TARGET_NAME)"; 551 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 552 | SWIFT_VERSION = 4.0; 553 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YiVideoEditor_Example.app/YiVideoEditor_Example"; 554 | }; 555 | name = Debug; 556 | }; 557 | 607FACF41AFB9204008FA782 /* Release */ = { 558 | isa = XCBuildConfiguration; 559 | baseConfigurationReference = 9AE6E9CD84D5187C9EB85629 /* Pods-YiVideoEditor_Tests.release.xcconfig */; 560 | buildSettings = { 561 | FRAMEWORK_SEARCH_PATHS = ( 562 | "$(PLATFORM_DIR)/Developer/Library/Frameworks", 563 | "$(inherited)", 564 | ); 565 | INFOPLIST_FILE = Tests/Info.plist; 566 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 567 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 568 | PRODUCT_NAME = "$(TARGET_NAME)"; 569 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 570 | SWIFT_VERSION = 4.0; 571 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/YiVideoEditor_Example.app/YiVideoEditor_Example"; 572 | }; 573 | name = Release; 574 | }; 575 | /* End XCBuildConfiguration section */ 576 | 577 | /* Begin XCConfigurationList section */ 578 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "YiVideoEditor" */ = { 579 | isa = XCConfigurationList; 580 | buildConfigurations = ( 581 | 607FACED1AFB9204008FA782 /* Debug */, 582 | 607FACEE1AFB9204008FA782 /* Release */, 583 | ); 584 | defaultConfigurationIsVisible = 0; 585 | defaultConfigurationName = Release; 586 | }; 587 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "YiVideoEditor_Example" */ = { 588 | isa = XCConfigurationList; 589 | buildConfigurations = ( 590 | 607FACF01AFB9204008FA782 /* Debug */, 591 | 607FACF11AFB9204008FA782 /* Release */, 592 | ); 593 | defaultConfigurationIsVisible = 0; 594 | defaultConfigurationName = Release; 595 | }; 596 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "YiVideoEditor_Tests" */ = { 597 | isa = XCConfigurationList; 598 | buildConfigurations = ( 599 | 607FACF31AFB9204008FA782 /* Debug */, 600 | 607FACF41AFB9204008FA782 /* Release */, 601 | ); 602 | defaultConfigurationIsVisible = 0; 603 | defaultConfigurationName = Release; 604 | }; 605 | /* End XCConfigurationList section */ 606 | }; 607 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 608 | } 609 | -------------------------------------------------------------------------------- /Example/YiVideoEditor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/YiVideoEditor.xcodeproj/xcshareddata/xcschemes/YiVideoEditor-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 45 | 46 | 48 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 80 | 82 | 88 | 89 | 90 | 91 | 92 | 93 | 99 | 101 | 107 | 108 | 109 | 110 | 112 | 113 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Example/YiVideoEditor.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/YiVideoEditor.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // YiVideoEditor 4 | // 5 | // Created by coderyi on 10/04/2021. 6 | // Copyright (c) 2021 coderyi. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | window = UIWindow(frame:UIScreen.main.bounds) 20 | window!.makeKeyAndVisible() 21 | window!.rootViewController = UINavigationController(rootViewController: HomeViewController()) 22 | 23 | return true 24 | } 25 | 26 | func applicationWillResignActive(_ application: UIApplication) { 27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 29 | } 30 | 31 | func applicationDidEnterBackground(_ application: UIApplication) { 32 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | func applicationWillEnterForeground(_ application: UIApplication) { 37 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 38 | } 39 | 40 | func applicationDidBecomeActive(_ application: UIApplication) { 41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 42 | } 43 | 44 | func applicationWillTerminate(_ application: UIApplication) { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | } 47 | 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/HomeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HomeViewController.swift 3 | // YiVideoEditor_Example 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // Copyright © 2021 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import YiVideoEditor 11 | 12 | class HomeViewController: UIViewController { 13 | var camera: LLSimpleCamera? 14 | lazy var snapButton: UIButton = { 15 | let button = UIButton(type: .system) 16 | button.layer.cornerRadius = 80.0 / 2.0 17 | button.layer.masksToBounds = true 18 | button.layer.borderColor = UIColor.white.cgColor 19 | button.layer.borderWidth = 2.0 20 | return button 21 | }() 22 | 23 | lazy var snapButtonBgView: UIVisualEffectView = { 24 | let effect = UIBlurEffect(style: .light) 25 | let effectView = UIVisualEffectView(effect: effect) 26 | effectView.layer.cornerRadius = 80.0 / 2.0 27 | effectView.layer.masksToBounds = true 28 | return effectView 29 | }() 30 | 31 | var discLayer: CAShapeLayer = { 32 | let radius = 6 33 | let layer = CAShapeLayer() 34 | layer.fillColor = UIColor(red: 208.0 / 255.0, green: 2.0 / 255.0, blue: 27.0 / 255.0, alpha: 1).cgColor 35 | layer.bounds = CGRect(x: 0, y: 0, width: 2 * radius, height: 2 * radius) 36 | layer.path = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 2 * radius, height: 2 * radius)).cgPath 37 | return layer 38 | }() 39 | 40 | override func viewDidLoad() { 41 | super.viewDidLoad() 42 | // Do any additional setup after loading the view, typically from a nib. 43 | view.backgroundColor = .white 44 | navigationController?.isNavigationBarHidden = true 45 | let screenRect = UIScreen.main.bounds 46 | camera = LLSimpleCamera(quality: AVCaptureSession.Preset.hd1280x720.rawValue, position: CameraPositionBack, videoEnabled: true) 47 | camera?.attach(to: self, withFrame: CGRect(x: 0, y: 0, width: screenRect.size.width, height: screenRect.size.height)) 48 | camera?.onDeviceChange = { (camera, device) in 49 | 50 | } 51 | camera?.onError = { (camera, error) in 52 | 53 | } 54 | 55 | let snapButtonSize = CGSize(width: 80, height: 80) 56 | view.addSubview(snapButtonBgView) 57 | snapButtonBgView.frame = CGRect(x: (UIScreen.main.bounds.size.width - 80) / 2, y: UIScreen.main.bounds.size.height - 80 - 20, width: 80, height: 80) 58 | snapButtonBgView.contentView.addSubview(snapButton) 59 | snapButton.addTarget(self, action: #selector(snapButtonTouchDown), for: .touchDown) 60 | snapButton.addTarget(self, action: #selector(snapButtonTouchUpInside), for: .touchUpInside) 61 | snapButton.addTarget(self, action: #selector(snapButtonTouchUpOutside), for: .touchUpOutside) 62 | snapButton.frame = snapButtonBgView.bounds 63 | discLayer.anchorPoint = CGPoint(x: 0.5, y: 0.5) 64 | discLayer.position = CGPoint(x: snapButtonSize.width / 2.0, y: snapButtonSize.height / 2.0) 65 | discLayer.isHidden = true 66 | snapButtonBgView.layer.addSublayer(discLayer) 67 | 68 | } 69 | 70 | @objc func snapButtonTouchDown() -> Void { 71 | startCapturing() 72 | } 73 | @objc func snapButtonTouchUpInside() -> Void { 74 | stopCapturing() 75 | } 76 | @objc func snapButtonTouchUpOutside() -> Void { 77 | stopCapturing() 78 | } 79 | 80 | func startCapturing() { 81 | let filePath:String = NSHomeDirectory() + "/Documents/test1.mov" 82 | let outputURL = URL(fileURLWithPath: filePath) 83 | camera?.startRecording(withOutputUrl: outputURL) 84 | animateButton() 85 | } 86 | 87 | func stopCapturing() { 88 | camera?.stopRecording({ [weak self] (camera, outputFileUrl, error) in 89 | guard let `self` = self else { 90 | return 91 | } 92 | if let outputFileUrl = outputFileUrl { 93 | self.editVideo(videoURL: outputFileUrl) 94 | } 95 | }) 96 | snapButton.layer.borderColor = UIColor.white.cgColor 97 | discLayer.isHidden = true 98 | let layer = discLayer.presentation() 99 | layer?.removeAllAnimations() 100 | } 101 | 102 | func editVideo(videoURL: URL) -> Void { 103 | let filePath:String = NSHomeDirectory() + "/Documents/output.mov" 104 | let exportUrl = URL(fileURLWithPath: filePath) 105 | 106 | guard let audioUrl = Bundle.main.url(forResource: "applause-01", withExtension: "mp3") else { 107 | return 108 | } 109 | 110 | let audioAsset = AVURLAsset(url: audioUrl) 111 | let layer = createVideoLayer() 112 | let videoEditor = YiVideoEditor(videoURL: videoURL) 113 | videoEditor.rotate(rotateDegree: .rotateDegree90) 114 | videoEditor.crop(cropFrame: CGRect(x: 10, y: 10, width: 300, height: 200)) 115 | videoEditor.addLayer(layer: layer) 116 | videoEditor.addAudio(asset: audioAsset, startingAt: 1, trackDuration: 3) 117 | videoEditor.export(exportURL: exportUrl) { [weak self] (session) in 118 | guard let `self` = self else { 119 | return 120 | } 121 | if session.status == .completed { 122 | let vc = VideoViewController(videoUrl: exportUrl) 123 | self.navigationController?.pushViewController(vc, animated: false) 124 | } 125 | } 126 | } 127 | 128 | func createVideoLayer() -> CALayer { 129 | let layer = CALayer() 130 | layer.backgroundColor = UIColor.red.cgColor 131 | layer.frame = CGRect(x: 10, y: 10, width: 100, height: 50) 132 | return layer 133 | } 134 | 135 | override func viewWillAppear(_ animated: Bool) { 136 | super.viewWillAppear(animated) 137 | camera?.start() 138 | } 139 | 140 | func animateButton() -> Void { 141 | snapButton.layer.borderColor = UIColor(red: 208.0 / 255.0, green: 2.0 / 255.0, blue: 27.0 / 255.0, alpha: 1).cgColor 142 | 143 | discLayer.isHidden = false 144 | let newRadius = 40 145 | let newBounds = CGRect(x: 0, y: 0, width: 2 * newRadius, height: 2 * newRadius) 146 | let newPath = UIBezierPath(ovalIn: CGRect(x: 0, y: 0, width: 2 * newRadius, height: 2 * newRadius)) 147 | let pathAnim = CABasicAnimation(keyPath: "path") 148 | pathAnim.toValue = newPath.cgPath 149 | let boundsAnim = CABasicAnimation(keyPath: "bounds") 150 | boundsAnim.toValue = newBounds 151 | 152 | let anims = CAAnimationGroup() 153 | anims.animations = [boundsAnim, pathAnim] 154 | anims.isRemovedOnCompletion = false 155 | anims.duration = 10.0 156 | anims.fillMode = kCAFillModeForwards 157 | discLayer.add(anims, forKey: nil) 158 | 159 | UIView.animate(withDuration: 0.25) { 160 | self.snapButtonBgView.transform = CGAffineTransform(scaleX: 1.2, y: 1.2) 161 | } completion: { (finished) in 162 | UIView.animate(withDuration: 0.3) { 163 | self.snapButtonBgView.transform = CGAffineTransform(scaleX: 0.9, y: 0.9) 164 | } completion: { (finished) in 165 | UIView.animate(withDuration: 0.3) { 166 | self.snapButtonBgView.transform = CGAffineTransform.identity 167 | } completion: { (finished) in 168 | } 169 | } 170 | } 171 | } 172 | 173 | override func didReceiveMemoryWarning() { 174 | super.didReceiveMemoryWarning() 175 | // Dispose of any resources that can be recreated. 176 | } 177 | 178 | } 179 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | 38 | NSCameraUsageDescription 39 | Camera Usage Description 40 | NSMicrophoneUsageDescription 41 | Microphone Usage Description 42 | 43 | 44 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/VideoViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // VideoViewController.swift 3 | // YiVideoEditor_Example 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // Copyright © 2021 CocoaPods. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class VideoViewController: UIViewController { 12 | 13 | var videoUrl: URL? 14 | var avPlayer: AVPlayer? 15 | var avPlayerLayer: AVPlayerLayer? 16 | 17 | convenience init(videoUrl: URL) { 18 | self.init(nibName: nil, bundle: nil) 19 | self.videoUrl = videoUrl 20 | } 21 | 22 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 23 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 24 | } 25 | 26 | required init?(coder: NSCoder) { 27 | fatalError("init(coder:) has not been implemented") 28 | } 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | // Do any additional setup after loading the view, typically from a nib. 33 | view.backgroundColor = .white 34 | if let videoUrl = videoUrl { 35 | avPlayer = AVPlayer(url: videoUrl) 36 | avPlayer?.actionAtItemEnd = .none 37 | avPlayerLayer = AVPlayerLayer(player: avPlayer) 38 | NotificationCenter.default.addObserver(self, selector: #selector(playerItemDidReachEnd(notification:)), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: avPlayer?.currentItem) 39 | let screenRect = UIScreen.main.bounds 40 | avPlayerLayer?.frame = CGRect(x: 0, y: 0, width: screenRect.size.width, height: screenRect.size.height) 41 | if let avPlayerLayer = avPlayerLayer { 42 | view.layer.addSublayer(avPlayerLayer) 43 | } 44 | } 45 | 46 | view.addSubview(cancelButton) 47 | cancelButton.addTarget(self, action: #selector(cancelButtonPressed), for: .touchUpInside) 48 | cancelButton.frame = CGRect(x: 0, y: 20, width: 44, height: 44) 49 | } 50 | 51 | override func viewWillAppear(_ animated: Bool) { 52 | super.viewWillAppear(animated) 53 | avPlayer?.play() 54 | } 55 | 56 | @objc func playerItemDidReachEnd(notification: Notification) { 57 | let p = notification.object as? AVPlayerItem 58 | p?.seek(to: kCMTimeZero) 59 | } 60 | 61 | lazy var cancelButton: UIButton = { 62 | let button = UIButton(type: .system) 63 | let cancelImage = UIImage(named: "cancel.png") 64 | button.tintColor = .white 65 | button.setImage(cancelImage, for: .normal) 66 | button.imageView?.clipsToBounds = false 67 | button.contentEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) 68 | button.layer.shadowColor = UIColor.black.cgColor 69 | button.layer.shadowOffset = CGSize(width: 0, height: 0) 70 | button.layer.shadowOpacity = 0.4 71 | button.layer.shadowRadius = 1.0 72 | button.clipsToBounds = false 73 | return button 74 | }() 75 | 76 | @objc func cancelButtonPressed() { 77 | navigationController?.popViewController(animated: true) 78 | } 79 | override func didReceiveMemoryWarning() { 80 | super.didReceiveMemoryWarning() 81 | // Dispose of any resources that can be recreated. 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/YiVideoEditor_Example-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import 6 | -------------------------------------------------------------------------------- /Example/YiVideoEditor/applause-01.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/YiVideoEditor/1156df43b95ced1c84d37d65875780a236e9f424/Example/YiVideoEditor/applause-01.mp3 -------------------------------------------------------------------------------- /Example/YiVideoEditor/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/YiVideoEditor/1156df43b95ced1c84d37d65875780a236e9f424/Example/YiVideoEditor/cancel.png -------------------------------------------------------------------------------- /Example/YiVideoEditor/cancel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/YiVideoEditor/1156df43b95ced1c84d37d65875780a236e9f424/Example/YiVideoEditor/cancel@2x.png -------------------------------------------------------------------------------- /Example/YiVideoEditor/cancel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/YiVideoEditor/1156df43b95ced1c84d37d65875780a236e9f424/Example/YiVideoEditor/cancel@3x.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 coderyi 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YiVideoEditor 2 | 3 | [![CI Status](https://img.shields.io/travis/coderyi/YiVideoEditor.svg?style=flat)](https://travis-ci.org/coderyi/YiVideoEditor) 4 | [![Version](https://img.shields.io/cocoapods/v/YiVideoEditor.svg?style=flat)](https://cocoapods.org/pods/YiVideoEditor) 5 | [![License](https://img.shields.io/cocoapods/l/YiVideoEditor.svg?style=flat)](https://cocoapods.org/pods/YiVideoEditor) 6 | [![Platform](https://img.shields.io/cocoapods/p/YiVideoEditor.svg?style=flat)](https://cocoapods.org/pods/YiVideoEditor) 7 | 8 | 9 | YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos. 10 | 11 | YiVideoEditor是一个视频编辑库。支持旋转、裁剪、增加图层(水印)、增加音频。 12 | 13 | 14 | ## Installation 15 | 16 | YiVideoEditor is available through [CocoaPods](https://cocoapods.org). To install 17 | it, simply add the following line to your Podfile: 18 | 19 | ```ruby 20 | pod 'YiVideoEditor' 21 | ``` 22 | 23 | ## Usage 24 | 25 | ``` 26 | let videoEditor = YiVideoEditor(videoURL: videoURL) 27 | videoEditor.rotate(rotateDegree: .rotateDegree90) 28 | videoEditor.crop(cropFrame: CGRect(x: 10, y: 10, width: 300, height: 200)) 29 | videoEditor.addLayer(layer: layer) 30 | videoEditor.addAudio(asset: audioAsset, startingAt: 1, trackDuration: 3) 31 | videoEditor.export(exportURL: exportUrl) { [weak self] (session) in 32 | guard let `self` = self else { 33 | return 34 | } 35 | if session.status == .completed { 36 | let vc = VideoViewController(videoUrl: exportUrl) 37 | self.navigationController?.pushViewController(vc, animated: false) 38 | } 39 | } 40 | 41 | ``` 42 | 43 | ## Example 44 | 45 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 46 | 47 | 48 | 49 | 50 | ## License 51 | 52 | YiVideoEditor is available under the MIT license. See the LICENSE file for more info. 53 | -------------------------------------------------------------------------------- /YiVideoEditor.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint YiVideoEditor.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'YiVideoEditor' 11 | s.version = '0.1.0' 12 | s.summary = 'A short description of YiVideoEditor.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | TODO: Add long description of the pod here. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/coderyi/YiVideoEditor' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'coderyi' => 'coderyi@foxmail.com' } 28 | s.source = { :git => 'https://github.com/coderyi/YiVideoEditor.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '9.0' 32 | 33 | s.source_files = 'YiVideoEditor/Classes/**/*' 34 | 35 | # s.resource_bundles = { 36 | # 'YiVideoEditor' => ['YiVideoEditor/Assets/*.png'] 37 | # } 38 | 39 | # s.public_header_files = 'Pod/Classes/**/*.h' 40 | # s.frameworks = 'UIKit', 'MapKit' 41 | # s.dependency 'AFNetworking', '~> 2.3' 42 | end 43 | -------------------------------------------------------------------------------- /YiVideoEditor/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/YiVideoEditor/1156df43b95ced1c84d37d65875780a236e9f424/YiVideoEditor/Assets/.gitkeep -------------------------------------------------------------------------------- /YiVideoEditor/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coderyi/YiVideoEditor/1156df43b95ced1c84d37d65875780a236e9f424/YiVideoEditor/Classes/.gitkeep -------------------------------------------------------------------------------- /YiVideoEditor/Classes/Commands/YiAddAudioCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YiAddAudioCommand.swift 3 | // YiVideoEditor 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // 7 | 8 | import Foundation 9 | import AVFoundation 10 | 11 | class YiAddAudioCommand: NSObject, YiVideoEditorCommandProtocol { 12 | weak var videoData: YiVideoEditorData? 13 | var audioAsset: AVAsset 14 | var startingAt: CGFloat 15 | var trackDuration: CGFloat 16 | init(videoData: YiVideoEditorData, audioAsset: AVAsset, startingAt: CGFloat?, trackDuration: CGFloat?) { 17 | self.videoData = videoData 18 | self.audioAsset = audioAsset 19 | self.startingAt = startingAt ?? 0 20 | self.trackDuration = trackDuration ?? CGFloat.greatestFiniteMagnitude 21 | super.init() 22 | } 23 | 24 | func execute() { 25 | var track: AVAssetTrack? 26 | if audioAsset.tracks(withMediaType: .audio).count != 0 { 27 | track = audioAsset.tracks(withMediaType: .audio).first 28 | } else { 29 | return 30 | } 31 | let audioCompositionTrack = videoData?.composition?.addMutableTrack(withMediaType: .audio, preferredTrackID: kCMPersistentTrackID_Invalid) 32 | let videoDuration = videoData?.videoCompositionTrack?.timeRange.duration 33 | let startTime = CMTime(seconds: Double(startingAt), preferredTimescale: videoDuration?.timescale ?? CMTimeScale(0.0)) 34 | let trackDurationTime = CMTime(seconds: Double(trackDuration), preferredTimescale: videoDuration?.timescale ?? CMTimeScale(0.0)) 35 | if CMTimeCompare(videoDuration ?? kCMTimeZero, startTime) == -1 { 36 | return 37 | } 38 | 39 | let availableTrackDuration = CMTimeSubtract(videoDuration ?? kCMTimeZero, CMTime(seconds: Double(startingAt), preferredTimescale: videoDuration?.timescale ?? CMTimeScale(0.0))) 40 | var duration: CMTime? 41 | if CMTimeCompare(availableTrackDuration, track?.timeRange.duration ?? kCMTimeZero) == -1 { 42 | duration = availableTrackDuration 43 | } else { 44 | duration = track?.timeRange.duration 45 | } 46 | 47 | if CMTimeCompare(trackDurationTime, duration ?? kCMTimeZero) == -1 { 48 | duration = trackDurationTime 49 | } 50 | let timeRange = CMTimeRange(start: kCMTimeZero, duration: duration ?? kCMTimeZero) 51 | do { 52 | if let track = track { 53 | try audioCompositionTrack?.insertTimeRange(timeRange, of: track, at: startTime) 54 | } 55 | } catch { 56 | 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /YiVideoEditor/Classes/Commands/YiAddLayerCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YiAddLayerCommand.swift 3 | // YiVideoEditor 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // 7 | 8 | import Foundation 9 | import AVFoundation 10 | 11 | class YiAddLayerCommand: NSObject, YiVideoEditorCommandProtocol { 12 | weak var videoData: YiVideoEditorData? 13 | var layer: CALayer 14 | init(videoData: YiVideoEditorData, layer: CALayer) { 15 | self.videoData = videoData 16 | self.layer = layer 17 | super.init() 18 | } 19 | 20 | func execute() { 21 | guard let videoData = videoData else { 22 | return 23 | } 24 | let videoSize = videoData.videoSize 25 | let parentLayer = CALayer() 26 | let videoLayer = CALayer() 27 | parentLayer.frame = CGRect(x: 0, y: 0, width: videoSize.width, height: videoSize.height) 28 | videoLayer.frame = CGRect(x: 0, y: 0, width: videoSize.width, height: videoSize.height) 29 | parentLayer.addSublayer(videoLayer) 30 | parentLayer.addSublayer(layer) 31 | 32 | let duration = videoData.composition?.duration 33 | if videoData.videoComposition?.instructions.count == 0 { 34 | let instruction = AVMutableVideoCompositionInstruction() 35 | instruction.timeRange = CMTimeRange(start: kCMTimeZero, duration: duration ?? kCMTimeZero) 36 | if let videoCompositionTrack = videoData.videoCompositionTrack { 37 | let layerInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: videoCompositionTrack) 38 | instruction.layerInstructions = [layerInstruction] 39 | videoData.videoComposition?.instructions = [instruction] 40 | } 41 | } 42 | videoData.videoComposition?.animationTool = AVVideoCompositionCoreAnimationTool(postProcessingAsVideoLayer: videoLayer, in: parentLayer) 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /YiVideoEditor/Classes/Commands/YiCropCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YiCropCommand.swift 3 | // YiVideoEditor 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // 7 | 8 | import Foundation 9 | import AVFoundation 10 | 11 | class YiCropCommand: NSObject, YiVideoEditorCommandProtocol { 12 | weak var videoData: YiVideoEditorData? 13 | var cropFrame: CGRect 14 | init(videoData: YiVideoEditorData, cropFrame: CGRect) { 15 | self.videoData = videoData 16 | self.cropFrame = cropFrame 17 | super.init() 18 | } 19 | 20 | func execute() { 21 | var instruction: AVMutableVideoCompositionInstruction? 22 | var layerInstruction: AVMutableVideoCompositionLayerInstruction? 23 | let duration = videoData?.composition?.duration 24 | if videoData?.videoComposition?.instructions.count == 0 { 25 | instruction = AVMutableVideoCompositionInstruction() 26 | instruction?.timeRange = CMTimeRange(start: kCMTimeZero, duration: duration ?? kCMTimeZero) 27 | if let videoCompositionTrack = videoData?.videoCompositionTrack { 28 | layerInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: videoCompositionTrack) 29 | layerInstruction?.setCropRectangle(cropFrame, at: kCMTimeZero) 30 | let t1 = CGAffineTransform(translationX: -1 * cropFrame.origin.x, y: -1 * cropFrame.origin.y) 31 | layerInstruction?.setTransform(t1, at: kCMTimeZero) 32 | } 33 | } else { 34 | instruction = videoData?.videoComposition?.instructions.last as? AVMutableVideoCompositionInstruction 35 | layerInstruction = instruction?.layerInstructions.last as? AVMutableVideoCompositionLayerInstruction 36 | if let duration = duration { 37 | var start = CGAffineTransform() 38 | let success = layerInstruction?.getTransformRamp(for: duration, start: &start, end: nil, timeRange: nil) ?? false 39 | if !success { 40 | layerInstruction?.setCropRectangle(cropFrame, at: kCMTimeZero) 41 | let t1 = CGAffineTransform(translationX: -1 * cropFrame.origin.x, y: -1 * cropFrame.origin.y) 42 | layerInstruction?.setTransform(t1, at: kCMTimeZero) 43 | } else { 44 | let t1 = CGAffineTransform(translationX: -1 * cropFrame.origin.x, y: -1 * cropFrame.origin.y) 45 | let newTransform = start.concatenating(t1) 46 | layerInstruction?.setTransform(newTransform, at: kCMTimeZero) 47 | } 48 | } 49 | } 50 | videoData?.videoComposition?.renderSize = cropFrame.size 51 | videoData?.videoSize = cropFrame.size 52 | if let layerInstruction = layerInstruction { 53 | instruction?.layerInstructions = [layerInstruction] 54 | } 55 | if let instruction = instruction { 56 | videoData?.videoComposition?.instructions = [instruction] 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /YiVideoEditor/Classes/Commands/YiRotateCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YiRotateCommand.swift 3 | // YiVideoEditor 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // 7 | 8 | import Foundation 9 | import AVFoundation 10 | 11 | class YiRotateCommand: NSObject, YiVideoEditorCommandProtocol { 12 | weak var videoData: YiVideoEditorData? 13 | 14 | init(videoData: YiVideoEditorData) { 15 | self.videoData = videoData 16 | super.init() 17 | } 18 | 19 | func execute() { 20 | guard let videoData = videoData else { 21 | return 22 | } 23 | guard var videoSize = videoData.videoComposition?.renderSize else { 24 | return 25 | } 26 | var instruction: AVMutableVideoCompositionInstruction? 27 | var layerInstruction: AVMutableVideoCompositionLayerInstruction? 28 | let t1 = CGAffineTransform(translationX: videoSize.height, y: 0.0) 29 | let t2 = t1.rotated(by: CGFloat((90.0 / 180.0 * .pi))) 30 | videoSize = CGSize(width: videoSize.height, height: videoSize.width) 31 | let duration = videoData.videoCompositionTrack?.timeRange.duration 32 | if videoData.videoComposition?.instructions.count == 0 { 33 | instruction = AVMutableVideoCompositionInstruction() 34 | instruction?.timeRange = CMTimeRange(start: kCMTimeZero, duration: duration ?? kCMTimeZero) 35 | if let videoCompositionTrack = videoData.videoCompositionTrack { 36 | layerInstruction = AVMutableVideoCompositionLayerInstruction(assetTrack: videoCompositionTrack) 37 | layerInstruction?.setTransform(t2, at: kCMTimeZero) 38 | } 39 | } else { 40 | instruction = videoData.videoComposition?.instructions.last as? AVMutableVideoCompositionInstruction 41 | layerInstruction = instruction?.layerInstructions.last as? AVMutableVideoCompositionLayerInstruction 42 | if let duration = duration { 43 | //UnsafeMutablePointer? 44 | var start = CGAffineTransform() 45 | let success = layerInstruction?.getTransformRamp(for: duration, start: &start, end: nil, timeRange: nil) ?? false 46 | if !success { 47 | layerInstruction?.setTransform(t2, at: kCMTimeZero) 48 | } else { 49 | let newTransform = start.concatenating(t2) 50 | layerInstruction?.setTransform(newTransform, at: kCMTimeZero) 51 | } 52 | } 53 | } 54 | videoData.videoComposition?.renderSize = videoSize 55 | videoData.videoSize = videoSize 56 | if let layerInstruction = layerInstruction { 57 | instruction?.layerInstructions = [layerInstruction] 58 | } 59 | if let instruction = instruction { 60 | videoData.videoComposition?.instructions = [instruction] 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /YiVideoEditor/Classes/YiVideoEditor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YiVideoEditor.swift 3 | // YiVideoEditor 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // 7 | 8 | import Foundation 9 | import AVFoundation 10 | 11 | public enum YiVideoEditorRotateDegree: Int { 12 | case rotateDegree90 = 0 13 | case rotateDegree180 = 1 14 | case rotateDegree270 = 2 15 | } 16 | 17 | protocol YiVideoEditorCommandProtocol: NSObjectProtocol { 18 | func execute() 19 | } 20 | 21 | open class YiVideoEditor: NSObject { 22 | var videoData: YiVideoEditorData 23 | var commands: [Any] 24 | var exportSession: AVAssetExportSession? 25 | public init(videoURL: URL) { 26 | let asset = AVURLAsset(url: videoURL) 27 | self.videoData = YiVideoEditorData(asset: asset) 28 | self.commands = [] 29 | super.init() 30 | } 31 | 32 | public func rotate(rotateDegree: YiVideoEditorRotateDegree) -> Void { 33 | var commandCount = 0 34 | switch rotateDegree { 35 | case .rotateDegree90: 36 | commandCount = 1 37 | case .rotateDegree180: 38 | commandCount = 2 39 | case .rotateDegree270: 40 | commandCount = 3 41 | } 42 | for _ in 0..Void) { 88 | export(exportURL: exportURL, presetName: AVAssetExportPreset1280x720, optimizeForNetworkUse: true, outputFileType: AVFileType.mov, completion: completion) 89 | } 90 | 91 | func export(exportURL: URL, presetName: String, optimizeForNetworkUse: Bool, outputFileType: AVFileType, completion: @escaping (AVAssetExportSession)->Void) { 92 | applyCommands() 93 | if let videoDataComposition = videoData.composition?.copy() as? AVAsset { 94 | exportSession = AVAssetExportSession(asset: videoDataComposition, presetName: presetName) 95 | } 96 | if let videoComposition = videoData.videoComposition { 97 | exportSession?.videoComposition = videoComposition 98 | } 99 | if FileManager.default.isDeletableFile(atPath: exportURL.path) { 100 | do { 101 | try FileManager.default.removeItem(atPath: exportURL.path) 102 | } catch { 103 | } 104 | } 105 | exportSession?.outputFileType = outputFileType 106 | exportSession?.outputURL = exportURL 107 | exportSession?.shouldOptimizeForNetworkUse = optimizeForNetworkUse 108 | exportSession?.exportAsynchronously { 109 | DispatchQueue.main.async { 110 | let asset = AVURLAsset(url: exportURL) 111 | self.videoData = YiVideoEditorData(asset: asset) 112 | self.commands = [] 113 | if let exportSession = self.exportSession { 114 | completion(exportSession) 115 | } 116 | } 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /YiVideoEditor/Classes/YiVideoEditorData.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YiVideoEditorData.swift 3 | // YiVideoEditor 4 | // 5 | // Created by coderyi on 2021/10/4. 6 | // 7 | 8 | import Foundation 9 | import AVFoundation 10 | 11 | class YiVideoEditorData: NSObject { 12 | var asset: AVAsset 13 | var composition: AVMutableComposition? 14 | var assetVideoTrack: AVAssetTrack? 15 | var assetAudioTrack: AVAssetTrack? 16 | var videoComposition: AVMutableVideoComposition? 17 | var videoCompositionTrack: AVMutableCompositionTrack? 18 | var audioCompositionTrack: AVMutableCompositionTrack? 19 | var videoSize: CGSize = .zero 20 | init(asset: AVAsset) { 21 | self.asset = asset 22 | super.init() 23 | self.loadAsset(asset: asset) 24 | } 25 | 26 | func loadAsset(asset: AVAsset) -> Void { 27 | if asset.tracks(withMediaType: .video).count != 0 { 28 | assetVideoTrack = asset.tracks(withMediaType: .video).first 29 | } 30 | if asset.tracks(withMediaType: .audio).count != 0 { 31 | assetAudioTrack = asset.tracks(withMediaType: .audio).first 32 | } 33 | videoSize = assetVideoTrack?.naturalSize ?? .zero 34 | composition = AVMutableComposition() 35 | videoComposition = AVMutableVideoComposition() 36 | videoComposition?.frameDuration = CMTime(value: 1, timescale: 30) 37 | videoComposition?.renderSize = videoSize 38 | let insertionPoint: CMTime = kCMTimeZero 39 | if let assetVideoTrack = assetVideoTrack { 40 | videoCompositionTrack = composition?.addMutableTrack(withMediaType: .video, preferredTrackID: kCMPersistentTrackID_Invalid) 41 | do { 42 | try videoCompositionTrack?.insertTimeRange(CMTimeRange(start: kCMTimeZero, duration: asset.duration), of: assetVideoTrack, at: insertionPoint) 43 | } catch { 44 | } 45 | } 46 | if let assetAudioTrack = assetAudioTrack { 47 | audioCompositionTrack = composition?.addMutableTrack(withMediaType: .audio, preferredTrackID: kCMPersistentTrackID_Invalid) 48 | do { 49 | try audioCompositionTrack?.insertTimeRange(CMTimeRange(start: kCMTimeZero, duration: asset.duration), of: assetAudioTrack, at: insertionPoint) 50 | } catch { 51 | } 52 | } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj --------------------------------------------------------------------------------