├── .gitignore ├── .swiftpm └── xcode │ └── package.xcworkspace │ └── contents.xcworkspacedata ├── .travis.yml ├── Example ├── HCVimeoVideoExtractor.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── HCVimeoVideoExtractor-Example.xcscheme ├── HCVimeoVideoExtractor.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── swiftpm │ │ └── Package.resolved ├── HCVimeoVideoExtractor │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── ViewController.swift ├── Podfile ├── Podfile.lock └── Tests │ ├── Info.plist │ └── Tests.swift ├── HCVimeoVideoExtractor.podspec ├── HCVimeoVideoExtractor ├── Assets │ └── .gitkeep └── Classes │ └── .gitkeep ├── LICENSE ├── Package.swift ├── README.md ├── Sources ├── HCVimeoVideoExtractor │ ├── HCVimeoVideo.swift │ └── HCVimeoVideoExtractor.swift └── PrivacyInfo.xcprivacy └── Tests └── HCVimeoVideoExtractorTests └── HCVimeoVideoExtractorTests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 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 | # http://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 | # Pods/ 38 | -------------------------------------------------------------------------------- /.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 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/HCVimeoVideoExtractor.xcworkspace -scheme HCVimeoVideoExtractor-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 11 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 12 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 13 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 14 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 15 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 16 | F40A7C8B2BD1101D008E28F8 /* HCVimeoVideoExtractor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F40A7C892BD1101D008E28F8 /* HCVimeoVideoExtractor.swift */; }; 17 | F40A7C8C2BD1101D008E28F8 /* HCVimeoVideo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F40A7C8A2BD1101D008E28F8 /* HCVimeoVideo.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 607FACCF1AFB9204008FA782; 26 | remoteInfo = HCVimeoVideoExtractor; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 14F59CAD3BCDD607F0413FFF /* HCVimeoVideoExtractor.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = HCVimeoVideoExtractor.podspec; path = ../HCVimeoVideoExtractor.podspec; sourceTree = ""; }; 32 | 365FB253E6DF059BF503F497 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 33 | 607FACD01AFB9204008FA782 /* HCVimeoVideoExtractor_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HCVimeoVideoExtractor_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 36 | 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 37 | 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 38 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 39 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 40 | 607FACE51AFB9204008FA782 /* HCVimeoVideoExtractor_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HCVimeoVideoExtractor_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 43 | 6CF185A908077F6BC2E875DD /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 44 | F40A7C892BD1101D008E28F8 /* HCVimeoVideoExtractor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HCVimeoVideoExtractor.swift; sourceTree = ""; }; 45 | F40A7C8A2BD1101D008E28F8 /* HCVimeoVideo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HCVimeoVideo.swift; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 607FACC71AFB9204008FA782 = { 67 | isa = PBXGroup; 68 | children = ( 69 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 70 | 607FACD21AFB9204008FA782 /* Example for HCVimeoVideoExtractor */, 71 | 607FACE81AFB9204008FA782 /* Tests */, 72 | 607FACD11AFB9204008FA782 /* Products */, 73 | ); 74 | sourceTree = ""; 75 | }; 76 | 607FACD11AFB9204008FA782 /* Products */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 607FACD01AFB9204008FA782 /* HCVimeoVideoExtractor_Example.app */, 80 | 607FACE51AFB9204008FA782 /* HCVimeoVideoExtractor_Tests.xctest */, 81 | ); 82 | name = Products; 83 | sourceTree = ""; 84 | }; 85 | 607FACD21AFB9204008FA782 /* Example for HCVimeoVideoExtractor */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 89 | 607FACD71AFB9204008FA782 /* ViewController.swift */, 90 | F40A7C882BD1101D008E28F8 /* HCVimeoVideoExtractor */, 91 | 607FACD91AFB9204008FA782 /* Main.storyboard */, 92 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 93 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 94 | 607FACD31AFB9204008FA782 /* Supporting Files */, 95 | ); 96 | name = "Example for HCVimeoVideoExtractor"; 97 | path = HCVimeoVideoExtractor; 98 | sourceTree = ""; 99 | }; 100 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 607FACD41AFB9204008FA782 /* Info.plist */, 104 | ); 105 | name = "Supporting Files"; 106 | sourceTree = ""; 107 | }; 108 | 607FACE81AFB9204008FA782 /* Tests */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 607FACEB1AFB9204008FA782 /* Tests.swift */, 112 | 607FACE91AFB9204008FA782 /* Supporting Files */, 113 | ); 114 | path = Tests; 115 | sourceTree = ""; 116 | }; 117 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 607FACEA1AFB9204008FA782 /* Info.plist */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 14F59CAD3BCDD607F0413FFF /* HCVimeoVideoExtractor.podspec */, 129 | 365FB253E6DF059BF503F497 /* README.md */, 130 | 6CF185A908077F6BC2E875DD /* LICENSE */, 131 | ); 132 | name = "Podspec Metadata"; 133 | sourceTree = ""; 134 | }; 135 | F40A7C882BD1101D008E28F8 /* HCVimeoVideoExtractor */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | F40A7C892BD1101D008E28F8 /* HCVimeoVideoExtractor.swift */, 139 | F40A7C8A2BD1101D008E28F8 /* HCVimeoVideo.swift */, 140 | ); 141 | name = HCVimeoVideoExtractor; 142 | path = ../../Sources/HCVimeoVideoExtractor; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 607FACCF1AFB9204008FA782 /* HCVimeoVideoExtractor_Example */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "HCVimeoVideoExtractor_Example" */; 151 | buildPhases = ( 152 | 607FACCC1AFB9204008FA782 /* Sources */, 153 | 607FACCD1AFB9204008FA782 /* Frameworks */, 154 | 607FACCE1AFB9204008FA782 /* Resources */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | ); 160 | name = HCVimeoVideoExtractor_Example; 161 | packageProductDependencies = ( 162 | ); 163 | productName = HCVimeoVideoExtractor; 164 | productReference = 607FACD01AFB9204008FA782 /* HCVimeoVideoExtractor_Example.app */; 165 | productType = "com.apple.product-type.application"; 166 | }; 167 | 607FACE41AFB9204008FA782 /* HCVimeoVideoExtractor_Tests */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "HCVimeoVideoExtractor_Tests" */; 170 | buildPhases = ( 171 | 607FACE11AFB9204008FA782 /* Sources */, 172 | 607FACE21AFB9204008FA782 /* Frameworks */, 173 | 607FACE31AFB9204008FA782 /* Resources */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */, 179 | ); 180 | name = HCVimeoVideoExtractor_Tests; 181 | productName = Tests; 182 | productReference = 607FACE51AFB9204008FA782 /* HCVimeoVideoExtractor_Tests.xctest */; 183 | productType = "com.apple.product-type.bundle.unit-test"; 184 | }; 185 | /* End PBXNativeTarget section */ 186 | 187 | /* Begin PBXProject section */ 188 | 607FACC81AFB9204008FA782 /* Project object */ = { 189 | isa = PBXProject; 190 | attributes = { 191 | BuildIndependentTargetsInParallel = YES; 192 | LastSwiftUpdateCheck = 0830; 193 | LastUpgradeCheck = 1520; 194 | ORGANIZATIONNAME = CocoaPods; 195 | TargetAttributes = { 196 | 607FACCF1AFB9204008FA782 = { 197 | CreatedOnToolsVersion = 6.3.1; 198 | DevelopmentTeam = TVE6JC95ZP; 199 | LastSwiftMigration = 1520; 200 | }; 201 | 607FACE41AFB9204008FA782 = { 202 | CreatedOnToolsVersion = 6.3.1; 203 | DevelopmentTeam = TVE6JC95ZP; 204 | LastSwiftMigration = 1520; 205 | TestTargetID = 607FACCF1AFB9204008FA782; 206 | }; 207 | }; 208 | }; 209 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "HCVimeoVideoExtractor" */; 210 | compatibilityVersion = "Xcode 3.2"; 211 | developmentRegion = en; 212 | hasScannedForEncodings = 0; 213 | knownRegions = ( 214 | en, 215 | Base, 216 | ); 217 | mainGroup = 607FACC71AFB9204008FA782; 218 | packageReferences = ( 219 | ); 220 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 221 | projectDirPath = ""; 222 | projectRoot = ""; 223 | targets = ( 224 | 607FACCF1AFB9204008FA782 /* HCVimeoVideoExtractor_Example */, 225 | 607FACE41AFB9204008FA782 /* HCVimeoVideoExtractor_Tests */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | 607FACCE1AFB9204008FA782 /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 236 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 237 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | 607FACE31AFB9204008FA782 /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | /* End PBXResourcesBuildPhase section */ 249 | 250 | /* Begin PBXSourcesBuildPhase section */ 251 | 607FACCC1AFB9204008FA782 /* Sources */ = { 252 | isa = PBXSourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | F40A7C8B2BD1101D008E28F8 /* HCVimeoVideoExtractor.swift in Sources */, 256 | 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, 257 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 258 | F40A7C8C2BD1101D008E28F8 /* HCVimeoVideo.swift in Sources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | 607FACE11AFB9204008FA782 /* Sources */ = { 263 | isa = PBXSourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, 267 | ); 268 | runOnlyForDeploymentPostprocessing = 0; 269 | }; 270 | /* End PBXSourcesBuildPhase section */ 271 | 272 | /* Begin PBXTargetDependency section */ 273 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { 274 | isa = PBXTargetDependency; 275 | target = 607FACCF1AFB9204008FA782 /* HCVimeoVideoExtractor_Example */; 276 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; 277 | }; 278 | /* End PBXTargetDependency section */ 279 | 280 | /* Begin PBXVariantGroup section */ 281 | 607FACD91AFB9204008FA782 /* Main.storyboard */ = { 282 | isa = PBXVariantGroup; 283 | children = ( 284 | 607FACDA1AFB9204008FA782 /* Base */, 285 | ); 286 | name = Main.storyboard; 287 | sourceTree = ""; 288 | }; 289 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 290 | isa = PBXVariantGroup; 291 | children = ( 292 | 607FACDF1AFB9204008FA782 /* Base */, 293 | ); 294 | name = LaunchScreen.xib; 295 | sourceTree = ""; 296 | }; 297 | /* End PBXVariantGroup section */ 298 | 299 | /* Begin XCBuildConfiguration section */ 300 | 607FACED1AFB9204008FA782 /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ALWAYS_SEARCH_USER_PATHS = NO; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 309 | CLANG_WARN_BOOL_CONVERSION = YES; 310 | CLANG_WARN_COMMA = YES; 311 | CLANG_WARN_CONSTANT_CONVERSION = YES; 312 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 313 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 314 | CLANG_WARN_EMPTY_BODY = YES; 315 | CLANG_WARN_ENUM_CONVERSION = YES; 316 | CLANG_WARN_INFINITE_RECURSION = YES; 317 | CLANG_WARN_INT_CONVERSION = YES; 318 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 319 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 320 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 322 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 323 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 324 | CLANG_WARN_STRICT_PROTOTYPES = YES; 325 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 326 | CLANG_WARN_UNREACHABLE_CODE = YES; 327 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 328 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 329 | COPY_PHASE_STRIP = NO; 330 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 331 | ENABLE_STRICT_OBJC_MSGSEND = YES; 332 | ENABLE_TESTABILITY = YES; 333 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 334 | GCC_C_LANGUAGE_STANDARD = gnu99; 335 | GCC_DYNAMIC_NO_PIC = NO; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_OPTIMIZATION_LEVEL = 0; 338 | GCC_PREPROCESSOR_DEFINITIONS = ( 339 | "DEBUG=1", 340 | "$(inherited)", 341 | ); 342 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 350 | MTL_ENABLE_DEBUG_INFO = YES; 351 | ONLY_ACTIVE_ARCH = YES; 352 | SDKROOT = iphoneos; 353 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 354 | }; 355 | name = Debug; 356 | }; 357 | 607FACEE1AFB9204008FA782 /* Release */ = { 358 | isa = XCBuildConfiguration; 359 | buildSettings = { 360 | ALWAYS_SEARCH_USER_PATHS = NO; 361 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 362 | CLANG_CXX_LIBRARY = "libc++"; 363 | CLANG_ENABLE_MODULES = YES; 364 | CLANG_ENABLE_OBJC_ARC = YES; 365 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 366 | CLANG_WARN_BOOL_CONVERSION = YES; 367 | CLANG_WARN_COMMA = YES; 368 | CLANG_WARN_CONSTANT_CONVERSION = YES; 369 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 371 | CLANG_WARN_EMPTY_BODY = YES; 372 | CLANG_WARN_ENUM_CONVERSION = YES; 373 | CLANG_WARN_INFINITE_RECURSION = YES; 374 | CLANG_WARN_INT_CONVERSION = YES; 375 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 376 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 377 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 378 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 379 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 380 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 381 | CLANG_WARN_STRICT_PROTOTYPES = YES; 382 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 383 | CLANG_WARN_UNREACHABLE_CODE = YES; 384 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 386 | COPY_PHASE_STRIP = NO; 387 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 388 | ENABLE_NS_ASSERTIONS = NO; 389 | ENABLE_STRICT_OBJC_MSGSEND = YES; 390 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 391 | GCC_C_LANGUAGE_STANDARD = gnu99; 392 | GCC_NO_COMMON_BLOCKS = YES; 393 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 394 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 395 | GCC_WARN_UNDECLARED_SELECTOR = YES; 396 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 397 | GCC_WARN_UNUSED_FUNCTION = YES; 398 | GCC_WARN_UNUSED_VARIABLE = YES; 399 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 400 | MTL_ENABLE_DEBUG_INFO = NO; 401 | SDKROOT = iphoneos; 402 | SWIFT_COMPILATION_MODE = wholemodule; 403 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 404 | VALIDATE_PRODUCT = YES; 405 | }; 406 | name = Release; 407 | }; 408 | 607FACF01AFB9204008FA782 /* Debug */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 412 | DEVELOPMENT_TEAM = TVE6JC95ZP; 413 | INFOPLIST_FILE = HCVimeoVideoExtractor/Info.plist; 414 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 415 | LD_RUNPATH_SEARCH_PATHS = ( 416 | "$(inherited)", 417 | "@executable_path/Frameworks", 418 | ); 419 | MARKETING_VERSION = 0.0.3; 420 | MODULE_NAME = ExampleApp; 421 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 422 | PRODUCT_NAME = "$(TARGET_NAME)"; 423 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 424 | SWIFT_VERSION = 5.0; 425 | }; 426 | name = Debug; 427 | }; 428 | 607FACF11AFB9204008FA782 /* Release */ = { 429 | isa = XCBuildConfiguration; 430 | buildSettings = { 431 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 432 | DEVELOPMENT_TEAM = TVE6JC95ZP; 433 | INFOPLIST_FILE = HCVimeoVideoExtractor/Info.plist; 434 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 435 | LD_RUNPATH_SEARCH_PATHS = ( 436 | "$(inherited)", 437 | "@executable_path/Frameworks", 438 | ); 439 | MARKETING_VERSION = 0.0.3; 440 | MODULE_NAME = ExampleApp; 441 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 444 | SWIFT_VERSION = 5.0; 445 | }; 446 | name = Release; 447 | }; 448 | 607FACF31AFB9204008FA782 /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | DEVELOPMENT_TEAM = TVE6JC95ZP; 452 | FRAMEWORK_SEARCH_PATHS = ( 453 | "$(SDKROOT)/Developer/Library/Frameworks", 454 | "$(inherited)", 455 | ); 456 | GCC_PREPROCESSOR_DEFINITIONS = ( 457 | "DEBUG=1", 458 | "$(inherited)", 459 | ); 460 | INFOPLIST_FILE = Tests/Info.plist; 461 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 462 | LD_RUNPATH_SEARCH_PATHS = ( 463 | "$(inherited)", 464 | "@executable_path/Frameworks", 465 | "@loader_path/Frameworks", 466 | ); 467 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 470 | SWIFT_VERSION = 5.0; 471 | }; 472 | name = Debug; 473 | }; 474 | 607FACF41AFB9204008FA782 /* Release */ = { 475 | isa = XCBuildConfiguration; 476 | buildSettings = { 477 | DEVELOPMENT_TEAM = TVE6JC95ZP; 478 | FRAMEWORK_SEARCH_PATHS = ( 479 | "$(SDKROOT)/Developer/Library/Frameworks", 480 | "$(inherited)", 481 | ); 482 | INFOPLIST_FILE = Tests/Info.plist; 483 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 484 | LD_RUNPATH_SEARCH_PATHS = ( 485 | "$(inherited)", 486 | "@executable_path/Frameworks", 487 | "@loader_path/Frameworks", 488 | ); 489 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 490 | PRODUCT_NAME = "$(TARGET_NAME)"; 491 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 492 | SWIFT_VERSION = 5.0; 493 | }; 494 | name = Release; 495 | }; 496 | /* End XCBuildConfiguration section */ 497 | 498 | /* Begin XCConfigurationList section */ 499 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "HCVimeoVideoExtractor" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | 607FACED1AFB9204008FA782 /* Debug */, 503 | 607FACEE1AFB9204008FA782 /* Release */, 504 | ); 505 | defaultConfigurationIsVisible = 0; 506 | defaultConfigurationName = Release; 507 | }; 508 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "HCVimeoVideoExtractor_Example" */ = { 509 | isa = XCConfigurationList; 510 | buildConfigurations = ( 511 | 607FACF01AFB9204008FA782 /* Debug */, 512 | 607FACF11AFB9204008FA782 /* Release */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | defaultConfigurationName = Release; 516 | }; 517 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "HCVimeoVideoExtractor_Tests" */ = { 518 | isa = XCConfigurationList; 519 | buildConfigurations = ( 520 | 607FACF31AFB9204008FA782 /* Debug */, 521 | 607FACF41AFB9204008FA782 /* Release */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | /* End XCConfigurationList section */ 527 | }; 528 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 529 | } 530 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor.xcodeproj/xcshareddata/xcschemes/HCVimeoVideoExtractor-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 51 | 52 | 53 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 76 | 78 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "hcvimeovideoextractor", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/superm0/HCVimeoVideoExtractor", 7 | "state" : { 8 | "revision" : "7f985183fe60dd66a366f67d9475c45938608b1a", 9 | "version" : "0.0.4" 10 | } 11 | } 12 | ], 13 | "version" : 2 14 | } 15 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // HCVimeoVideoExtractor 4 | // 5 | // Created by Mo Cariaga on 02/14/2018. 6 | // Copyright (c) 2018 Mo Cariaga. 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: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // 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. 24 | // 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. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // 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. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // 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. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor/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 | 32 | 33 | 43 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor/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/HCVimeoVideoExtractor/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 | 39 | 40 | -------------------------------------------------------------------------------- /Example/HCVimeoVideoExtractor/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // HCVimeoVideoExtractor 4 | // 5 | // Created by Mo Cariaga on 02/14/2018. 6 | // Copyright (c) 2018 Mo Cariaga. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AVKit 11 | import AVFoundation 12 | import HCVimeoVideoExtractor 13 | 14 | 15 | class ViewController: UIViewController { 16 | 17 | @IBOutlet weak var txtVimeoURL: UITextField! 18 | @IBOutlet weak var lblTitle: UILabel! 19 | @IBOutlet weak var imageView: UIImageView! 20 | 21 | var videoURL: URL? 22 | 23 | override func viewDidLoad() { 24 | super.viewDidLoad() 25 | // Do any additional setup after loading the view, typically from a nib. 26 | self.txtVimeoURL.text = "https://vimeo.com/254597739" 27 | } 28 | 29 | override func didReceiveMemoryWarning() { 30 | super.didReceiveMemoryWarning() 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | @IBAction func getVideoURL(_ sender: Any) { 35 | 36 | if let url = URL(string: self.txtVimeoURL.text!) { 37 | HCVimeoVideoExtractor.fetchVideoURLFrom(url: url, completion: { ( video:HCVimeoVideo?, error:Error?) -> Void in 38 | 39 | if let err = error { 40 | 41 | print("Error = \(err.localizedDescription)") 42 | 43 | DispatchQueue.main.async() { 44 | self.lblTitle.text = "-" 45 | self.imageView.image = nil 46 | self.videoURL = nil 47 | 48 | let alert = UIAlertController(title: "Error", message: err.localizedDescription, preferredStyle: .alert) 49 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) 50 | self.present(alert, animated: true, completion: nil) 51 | } 52 | return 53 | } 54 | 55 | guard let vid = video else { 56 | print("Invalid video object") 57 | return 58 | } 59 | 60 | print("Title = \(vid.title), url = \(vid.videoURL), thumbnail = \(vid.thumbnailURL)") 61 | 62 | 63 | /* 64 | let player = AVPlayer(url: vid.videoURL[.Quality540p]!) 65 | let playerController = AVPlayerViewController() 66 | playerController.player = player 67 | self.present(playerController, animated: true) { 68 | player.play() 69 | */ 70 | 71 | DispatchQueue.main.async() { 72 | self.videoURL = vid.videoURL[.quality1080p] 73 | self.lblTitle.text = vid.title 74 | 75 | if let url = vid.thumbnailURL[.qualityBase] { 76 | self.imageView.contentMode = .scaleAspectFit 77 | self.downloadImage(url: url) 78 | } 79 | } 80 | }) 81 | } 82 | 83 | /* 84 | HCVimeoVideoExtractor.fetchVideoURLFrom(id: "254597739", completion: { ( video:HCVimeoVideo?, error:Error?) -> Void in 85 | if let err = error { 86 | print("Error = \(err.localizedDescription)") 87 | return 88 | } 89 | 90 | guard let vid = video else { 91 | print("Invalid video object") 92 | return 93 | } 94 | 95 | print("Title = \(vid.title), url = \(vid.videoURL), thumbnail = \(vid.thumbnailURL)") 96 | 97 | if let videoURL = vid.videoURL[.Quality540p] { 98 | let player = AVPlayer(url: videoURL) 99 | let playerController = AVPlayerViewController() 100 | playerController.player = player 101 | self.present(playerController, animated: true) { 102 | player.play() 103 | } 104 | } 105 | }) 106 | */ 107 | } 108 | 109 | @IBAction func play(_ sender: Any) { 110 | 111 | if let url = self.videoURL { 112 | let player = AVPlayer(url: url) 113 | let playerController = AVPlayerViewController() 114 | playerController.player = player 115 | self.present(playerController, animated: true) { 116 | player.play() 117 | } 118 | } 119 | else { 120 | let alert = UIAlertController(title: "Error", message: "Invalid video URL", preferredStyle: .alert) 121 | alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) 122 | self.present(alert, animated: true, completion: nil) 123 | } 124 | } 125 | 126 | func downloadImage(url: URL) { 127 | getDataFromUrl(url: url) { data, response, error in 128 | guard let data = data, error == nil else { return } 129 | DispatchQueue.main.async() { 130 | self.imageView.image = UIImage(data: data) 131 | } 132 | } 133 | } 134 | 135 | func getDataFromUrl(url: URL, completion: @escaping (Data?, URLResponse?, Error?) -> ()) { 136 | URLSession.shared.dataTask(with: url) { data, response, error in 137 | completion(data, response, error) 138 | }.resume() 139 | } 140 | } 141 | 142 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | use_frameworks! 3 | 4 | target 'HCVimeoVideoExtractor_Example' do 5 | pod 'HCVimeoVideoExtractor', :path => '../' 6 | 7 | target 'HCVimeoVideoExtractor_Tests' do 8 | inherit! :search_paths 9 | 10 | 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - HCVimeoVideoExtractor (0.0.1) 3 | 4 | DEPENDENCIES: 5 | - HCVimeoVideoExtractor (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | HCVimeoVideoExtractor: 9 | :path: ../ 10 | 11 | SPEC CHECKSUMS: 12 | HCVimeoVideoExtractor: fc132786534872921745c4a19093bf722c22803c 13 | 14 | PODFILE CHECKSUM: 1f197f25350e55a60f403728be87347c3f349630 15 | 16 | COCOAPODS: 1.4.0 17 | -------------------------------------------------------------------------------- /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 UIKit 2 | import XCTest 3 | import HCVimeoVideoExtractor 4 | 5 | class Tests: XCTestCase { 6 | 7 | override func setUp() { 8 | super.setUp() 9 | // Put setup code here. This method is called before the invocation of each test method in the class. 10 | } 11 | 12 | override func tearDown() { 13 | // Put teardown code here. This method is called after the invocation of each test method in the class. 14 | super.tearDown() 15 | } 16 | 17 | func testExample() { 18 | // This is an example of a functional test case. 19 | XCTAssert(true, "Pass") 20 | } 21 | 22 | func testPerformanceExample() { 23 | // This is an example of a performance test case. 24 | self.measure() { 25 | // Put the code you want to measure the time of here. 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /HCVimeoVideoExtractor.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint HCVimeoVideoExtractor.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 http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'HCVimeoVideoExtractor' 11 | s.version = '0.0.5' 12 | s.summary = 'HCVimeoVideoExtractor is an easy way to extract the Vimeo video details.' 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 | HCVimeoVideoExtractor is an easy way to extract the Vimeo video details like title, thumbnails and mp4 URL's which then can be used to play using AVPlayerView. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/superm0/HCVimeoVideoExtractor' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'Mo Cariaga' => 'hermoso.cariaga@gmail.com' } 28 | s.source = { :git => 'https://github.com/superm0/HCVimeoVideoExtractor.git', :tag => s.version.to_s } 29 | s.social_media_url = 'https://twitter.com/sup3rm0' 30 | 31 | s.ios.deployment_target = '9.0' 32 | s.swift_version = '4.0' 33 | 34 | s.source_files = 'Sources/HCVimeoVideoExtractor/**/*' 35 | s.resource_bundles = {'HCVimeoVideoExtractor' => ['Sources/PrivacyInfo.xcprivacy']} 36 | # s.resource_bundles = { 37 | # 'HCVimeoVideoExtractor' => ['HCVimeoVideoExtractor/Assets/*.png'] 38 | # } 39 | 40 | # s.public_header_files = 'Pod/Classes/**/*.h' 41 | # s.frameworks = 'UIKit', 'MapKit' 42 | # s.dependency 'AFNetworking', '~> 2.3' 43 | end 44 | -------------------------------------------------------------------------------- /HCVimeoVideoExtractor/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superm0/HCVimeoVideoExtractor/22039673d5f04899a76253d3545bda4981bca520/HCVimeoVideoExtractor/Assets/.gitkeep -------------------------------------------------------------------------------- /HCVimeoVideoExtractor/Classes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/superm0/HCVimeoVideoExtractor/22039673d5f04899a76253d3545bda4981bca520/HCVimeoVideoExtractor/Classes/.gitkeep -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022 Mo Cariaga 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 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:5.5 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "HCVimeoVideoExtractor", 8 | platforms: [.iOS(.v12)], 9 | products: [ 10 | // Products define the executables and libraries a package produces, and make them visible to other packages. 11 | .library( 12 | name: "HCVimeoVideoExtractor", 13 | targets: ["HCVimeoVideoExtractor"]), 14 | ], 15 | dependencies: [ 16 | // Dependencies declare other packages that this package depends on. 17 | // .package(url: /* package url */, from: "1.0.0"), 18 | ], 19 | targets: [ 20 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 21 | // Targets can depend on other targets in this package, and on products in packages this package depends on. 22 | .target( 23 | name: "HCVimeoVideoExtractor", 24 | dependencies: []), 25 | .testTarget( 26 | name: "HCVimeoVideoExtractorTests", 27 | dependencies: ["HCVimeoVideoExtractor"]), 28 | ], 29 | swiftLanguageVersions: [.v5] 30 | ) 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # HCVimeoVideoExtractor 4 | 5 | HCVimeoVideoExtractor is an easy to use Swift library for retrieving the Vimeo video details like title, thumbnail and mp4 URL which then can be used to play using AVPlayerView. 6 | 7 |
8 | 9 | ## Requirements 10 | 11 | HCVimeoVideoExtractor requires iOS 9.0 and Swift 3.2 and above 12 | 13 |
14 | 15 | ## Installation 16 | 17 | 18 | ### CocoaPods 19 | 20 | HCVimeoVideoExtractor is available through [CocoaPods](http://cocoapods.org). To install 21 | it, simply add the following line to your Podfile: 22 | 23 | ```ruby 24 | pod 'HCVimeoVideoExtractor' 25 | ``` 26 | 27 | and run `pod install` 28 | 29 | 30 |
31 | 32 | ### Swift Package Manager 33 | For [Swift Package Manager](https://swift.org/package-manager/) add the following package to your Package.swift file. 34 | 35 | ```swift 36 | .package(url: "https://github.com/superm0/HCVimeoVideoExtractor.git", .upToNextMajor(from: "0.0.5")), 37 | ``` 38 | 39 |
40 | 41 | ## Usage 42 | 43 | Use the block based methods in `HCVimeoVideoExtractor` class to retrieve the Vimeo video details. Both methods will call a completion handler with two parameters. The first parameter is a `HCVimeoVideo` object which represents a Vimeo video. The second parameter is an `Error` object describing the network connection or internal processing error. 44 | 45 | ```swift 46 | import HCVimeoVideoExtractor 47 | ``` 48 | 49 | Retrieve the Vimeo video details using URL 50 | 51 | ```swift 52 | let url = URL(string: "https://vimeo.com/[video_id]")! 53 | HCVimeoVideoExtractor.fetchVideoURLFrom(url: url, completion: { ( video:HCVimeoVideo?, error:Error?) -> Void in 54 | if let err = error { 55 | print("Error = \(err.localizedDescription)") 56 | return 57 | } 58 | 59 | guard let vid = video else { 60 | print("Invalid video object") 61 | return 62 | } 63 | 64 | print("Title = \(vid.title), url = \(vid.videoURL), thumbnail = \(vid.thumbnailURL)") 65 | 66 | if let videoURL = vid.videoURL[.Quality1080p] { 67 | let player = AVPlayer(url: videoURL) 68 | let playerController = AVPlayerViewController() 69 | playerController.player = player 70 | self.present(playerController, animated: true) { 71 | player.play() 72 | } 73 | } 74 | }) 75 | ``` 76 | Retrieve the Vimeo video details using video ID 77 | ```swift 78 | HCVimeoVideoExtractor.fetchVideoURLFrom(id: "video_id", completion: { ( video:HCVimeoVideo?, error:Error?) -> Void in 79 | if let err = error { 80 | print("Error = \(err.localizedDescription)") 81 | return 82 | } 83 | 84 | guard let vid = video else { 85 | print("Invalid video object") 86 | return 87 | } 88 | 89 | print("Title = \(vid.title), url = \(vid.videoURL), thumbnail = \(vid.thumbnailURL)") 90 | 91 | if let videoURL = vid.videoURL[.quality1080p] { 92 | let player = AVPlayer(url: videoURL) 93 | let playerController = AVPlayerViewController() 94 | playerController.player = player 95 | self.present(playerController, animated: true) { 96 | player.play() 97 | } 98 | } 99 | }) 100 | ``` 101 | 102 | ## New Vimeo Videos 103 | For new Vimeo videos, starting October 2022, the video URL can be retrieved through ```.quality1080p``` or ```.qualityUnknown```. 104 | 105 | ## Author 106 | 107 | Mo Cariaga, hermoso.cariaga@gmail.com 108 | 109 | ## License 110 | 111 | HCVimeoVideoExtractor is available under the MIT license. See the LICENSE file for more info. 112 | -------------------------------------------------------------------------------- /Sources/HCVimeoVideoExtractor/HCVimeoVideo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HCVimeoVideo.swift 3 | // HCVimeoVideoExtractor 4 | // 5 | // Created by Mo Cariaga on 13/02/2018. 6 | // Copyright (c) 2018 Mo Cariaga 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #if canImport(UIKit) 27 | import UIKit 28 | 29 | public enum HCVimeoThumbnailQuality: String { 30 | case quality640 = "640" 31 | case quality960 = "960" 32 | case quality1280 = "1280" 33 | case qualityBase = "base" 34 | case qualityUnknown = "unknown" 35 | } 36 | 37 | public enum HCVimeoVideoQuality: String { 38 | case quality360p = "360p" 39 | case quality540p = "540p" 40 | case quality640p = "640p" 41 | case quality720p = "720p" 42 | case quality960p = "960p" 43 | case quality1080p = "1080p" 44 | case qualityUnknown = "unknown" 45 | } 46 | 47 | public class HCVimeoVideo: NSObject { 48 | public var title = "" 49 | public var thumbnailURL = [HCVimeoThumbnailQuality: URL]() 50 | public var videoURL = [HCVimeoVideoQuality: URL]() 51 | } 52 | #endif 53 | -------------------------------------------------------------------------------- /Sources/HCVimeoVideoExtractor/HCVimeoVideoExtractor.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HCVimeoVideoExtractor.swift 3 | // HCVimeoVideoExtractor 4 | // 5 | // Created by Mo Cariaga on 13/02/2018. 6 | // Copyright (c) 2018 Mo Cariaga 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #if canImport(UIKit) 27 | import UIKit 28 | 29 | public class HCVimeoVideoExtractor: NSObject { 30 | fileprivate static let domain = "ph.hercsoft.HCVimeoVideoExtractor" 31 | fileprivate let configURL = "https://player.vimeo.com/video/{id}/config?h={hash}" 32 | fileprivate var completion: ((_ video: HCVimeoVideo?, _ error:Error?) -> Void)? 33 | fileprivate var videoId: String = "" 34 | fileprivate var videoHash: String = "" 35 | 36 | 37 | public static func fetchVideoURLFrom(url: URL, completion: @escaping (_ video: HCVimeoVideo?, _ error:Error?) -> Void) -> Void { 38 | var id = "" 39 | var hash = "" 40 | for pathComponent in url.pathComponents { 41 | if id == "" && CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: pathComponent)) { 42 | id = pathComponent 43 | } 44 | else if id != "" && hash == "" && pathComponent.count == 10 && pathComponent.allSatisfy(\.isHexDigit) { 45 | hash = pathComponent.lowercased() 46 | } 47 | } 48 | hash = hash != "" ? hash : URLComponents(string: url.absoluteString)?.queryItems?.first(where: { $0.name == "h" })?.value ?? "" 49 | 50 | if id != "" { 51 | let videoExtractor = HCVimeoVideoExtractor(id: id, hash: hash) 52 | videoExtractor.completion = completion 53 | videoExtractor.start() 54 | } else { 55 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:0, userInfo:[NSLocalizedDescriptionKey : "Invalid video id" , NSLocalizedFailureReasonErrorKey : "Failed to parse the video id"])) 56 | } 57 | } 58 | 59 | public static func fetchVideoURLFrom(id: String, hash: String = "", completion: @escaping (_ video: HCVimeoVideo?, _ error:Error?) -> Void) -> Void { 60 | if id != "" { 61 | let videoExtractor = HCVimeoVideoExtractor(id: id, hash: hash) 62 | videoExtractor.completion = completion 63 | videoExtractor.start() 64 | } 65 | else { 66 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:0, userInfo:[NSLocalizedDescriptionKey : "Invalid video id" , NSLocalizedFailureReasonErrorKey : "Invalid video id"])) 67 | } 68 | } 69 | 70 | private init(id: String, hash: String = "") { 71 | videoId = id 72 | videoHash = hash 73 | completion = nil 74 | super.init() 75 | } 76 | 77 | private func start() -> Void { 78 | 79 | guard let completion = completion else { 80 | print("ERROR: Invalid completion handler") 81 | return 82 | } 83 | 84 | if videoId == "" { 85 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:0, userInfo:[NSLocalizedDescriptionKey : "Invalid video id" , NSLocalizedFailureReasonErrorKey : "Invalid video id"])) 86 | return 87 | } 88 | 89 | let dataURL = configURL.replacingOccurrences(of: "{id}", with: videoId).replacingOccurrences(of: "{hash}", with: videoHash) 90 | if let url = URL(string: dataURL) { 91 | let urlRequest = URLRequest(url: url) 92 | let session = URLSession.shared 93 | 94 | let task = session.dataTask(with: urlRequest, completionHandler: { (data, response, error) in 95 | 96 | guard error == nil else { 97 | completion(nil, error) 98 | return 99 | } 100 | 101 | guard let responseData = data else { 102 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:2, userInfo:[NSLocalizedDescriptionKey : "Invalid response" , NSLocalizedFailureReasonErrorKey : "Invalid response from Vimeo"])) 103 | return 104 | } 105 | 106 | do { 107 | guard let data = try JSONSerialization.jsonObject(with: responseData, options: []) as? [String: AnyObject] else { 108 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:3, userInfo:[NSLocalizedDescriptionKey : "Invalid response" , NSLocalizedFailureReasonErrorKey : "Failed to parse Vimeo response"])) 109 | return 110 | } 111 | 112 | let video = HCVimeoVideo() 113 | if let title = (data as NSDictionary).value(forKeyPath: "video.title") as? String { 114 | video.title = title 115 | } 116 | 117 | if let thumbnails = (data as NSDictionary).value(forKeyPath: "video.thumbs") as? Dictionary { 118 | for (quality, url) in thumbnails { 119 | if let turl = url as? String { 120 | video.thumbnailURL[self.thumbnailQualityWith(string: quality)] = URL(string: turl) 121 | } 122 | } 123 | } 124 | 125 | if let files = (data as NSDictionary).value(forKeyPath: "request.files.progressive") as? Array>, files.count > 0 { 126 | for file in files { 127 | if let quality = file["quality"] as? String { 128 | if let url = file["url"] as? String { 129 | video.videoURL[self.videoQualityWith(string: quality)] = URL(string: url) 130 | } 131 | } 132 | } 133 | } 134 | 135 | if video.videoURL.count == 0, 136 | let hls = (data as NSDictionary).value(forKeyPath: "request.files.hls.cdns") as? [String: AnyObject], 137 | let url = hls.first?.value["url"] as? String { 138 | video.videoURL[.quality1080p] = URL(string: url) 139 | video.videoURL[.qualityUnknown] = URL(string: url) 140 | } 141 | 142 | if video.videoURL.count > 0 { 143 | completion(video, nil) 144 | } 145 | else { 146 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:4, userInfo:[NSLocalizedDescriptionKey : "Failed to retrieve mp4 video url" , NSLocalizedFailureReasonErrorKey : "Failed to retrieve mp4 video url"])) 147 | } 148 | } catch { 149 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:3, userInfo:[NSLocalizedDescriptionKey : "Failed to parse Vimeo response" , NSLocalizedFailureReasonErrorKey : "Failed to parse Vimeo response"])) 150 | return 151 | } 152 | }) 153 | task.resume() 154 | } 155 | else { 156 | completion(nil, NSError(domain: HCVimeoVideoExtractor.domain, code:1, userInfo:[NSLocalizedDescriptionKey : "Failed to retrieve video URL" , NSLocalizedFailureReasonErrorKey : "Failed to retrieve video URL"])) 157 | } 158 | } 159 | 160 | private func videoQualityWith(string: String) -> HCVimeoVideoQuality { 161 | return HCVimeoVideoQuality(rawValue: string) ?? .qualityUnknown 162 | } 163 | 164 | private func thumbnailQualityWith(string: String) -> HCVimeoThumbnailQuality { 165 | return HCVimeoThumbnailQuality(rawValue: string) ?? .qualityUnknown 166 | } 167 | } 168 | #endif 169 | -------------------------------------------------------------------------------- /Sources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTracking 6 | 7 | NSPrivacyTrackingDomains 8 | 9 | NSPrivacyCollectedDataTypes 10 | 11 | NSPrivacyAccessedAPITypes 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Tests/HCVimeoVideoExtractorTests/HCVimeoVideoExtractorTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | @testable import HCVimeoVideoExtractor 3 | 4 | final class HCVimeoVideoExtractorTests: XCTestCase { 5 | func testExample() throws { 6 | // This is an example of a functional test case. 7 | // Use XCTAssert and related functions to verify your tests produce the correct 8 | // results. 9 | // XCTAssertEqual(HCVimeoVideoExtractor().text, "Hello, World!") 10 | } 11 | } 12 | --------------------------------------------------------------------------------