├── .gitignore ├── HAPlayerView.podspec ├── HAPlayerView.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── HAPlayerView.xcscheme ├── HAPlayerView.xcworkspace └── contents.xcworkspacedata ├── HAPlayerView ├── HABackgroundPlayerView.swift ├── HAPlayerView.h └── Info.plist ├── HAPlayerViewTests ├── HAPlayerViewTests.swift └── Info.plist ├── Images ├── Captura de pantalla 2017-02-14 a las 18.34.58.png ├── Captura de pantalla 2017-02-14 a las 18.35.17.png ├── Captura de pantalla 2017-02-15 a las 12.00.53.png └── out.gif ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /HAPlayerView.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "HAPlayerView" 3 | s.version = "0.1.2" 4 | s.summary = "HAPlayerView manage video background." 5 | s.description = <<-DESC 6 | HAPlayerView is a simple class to manage typical splash or login view, with a background video managed for interfce builder. 7 | DESC 8 | 9 | s.homepage = "https://github.com/litoarias/HAPlayerView" 10 | s.license = { :type => "MIT", :file => "LICENSE" } 11 | s.author = { "Hipolito Arias" => "lito.arias.cervero@gmail.com" } 12 | s.social_media_url = "https://twitter.com/soy_lito" 13 | s.source = { :git => "https://github.com/litoarias/HAPlayerView.git", :tag => "#{s.version}" } 14 | s.ios.deployment_target = '9.0' 15 | s.source_files = 'HAPlayerView/HABackgroundPlayerView.swift' 16 | end 17 | -------------------------------------------------------------------------------- /HAPlayerView.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0AC19E9C1E53109500B2F4A1 /* HAPlayerView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AC19E921E53109500B2F4A1 /* HAPlayerView.framework */; }; 11 | 0AC19EA11E53109500B2F4A1 /* HAPlayerViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AC19EA01E53109500B2F4A1 /* HAPlayerViewTests.swift */; }; 12 | 0AC19EA31E53109500B2F4A1 /* HAPlayerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0AC19E951E53109500B2F4A1 /* HAPlayerView.h */; settings = {ATTRIBUTES = (Public, ); }; }; 13 | 0AC19EAD1E53113E00B2F4A1 /* HABackgroundPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AC19EAC1E53113E00B2F4A1 /* HABackgroundPlayerView.swift */; }; 14 | /* End PBXBuildFile section */ 15 | 16 | /* Begin PBXContainerItemProxy section */ 17 | 0AC19E9D1E53109500B2F4A1 /* PBXContainerItemProxy */ = { 18 | isa = PBXContainerItemProxy; 19 | containerPortal = 0AC19E891E53109500B2F4A1 /* Project object */; 20 | proxyType = 1; 21 | remoteGlobalIDString = 0AC19E911E53109500B2F4A1; 22 | remoteInfo = HAPlayerView; 23 | }; 24 | /* End PBXContainerItemProxy section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 0AC19E921E53109500B2F4A1 /* HAPlayerView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HAPlayerView.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 0AC19E951E53109500B2F4A1 /* HAPlayerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HAPlayerView.h; sourceTree = ""; }; 29 | 0AC19E961E53109500B2F4A1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 0AC19E9B1E53109500B2F4A1 /* HAPlayerViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HAPlayerViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 0AC19EA01E53109500B2F4A1 /* HAPlayerViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HAPlayerViewTests.swift; sourceTree = ""; }; 32 | 0AC19EA21E53109500B2F4A1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | 0AC19EAC1E53113E00B2F4A1 /* HABackgroundPlayerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HABackgroundPlayerView.swift; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | 0AC19E8E1E53109500B2F4A1 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | 0AC19E981E53109500B2F4A1 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | 0AC19E9C1E53109500B2F4A1 /* HAPlayerView.framework in Frameworks */, 49 | ); 50 | runOnlyForDeploymentPostprocessing = 0; 51 | }; 52 | /* End PBXFrameworksBuildPhase section */ 53 | 54 | /* Begin PBXGroup section */ 55 | 0AC19E881E53109500B2F4A1 = { 56 | isa = PBXGroup; 57 | children = ( 58 | 0AC19E941E53109500B2F4A1 /* HAPlayerView */, 59 | 0AC19E9F1E53109500B2F4A1 /* HAPlayerViewTests */, 60 | 0AC19E931E53109500B2F4A1 /* Products */, 61 | ); 62 | sourceTree = ""; 63 | }; 64 | 0AC19E931E53109500B2F4A1 /* Products */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | 0AC19E921E53109500B2F4A1 /* HAPlayerView.framework */, 68 | 0AC19E9B1E53109500B2F4A1 /* HAPlayerViewTests.xctest */, 69 | ); 70 | name = Products; 71 | sourceTree = ""; 72 | }; 73 | 0AC19E941E53109500B2F4A1 /* HAPlayerView */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 0AC19E951E53109500B2F4A1 /* HAPlayerView.h */, 77 | 0AC19EAC1E53113E00B2F4A1 /* HABackgroundPlayerView.swift */, 78 | 0AC19E961E53109500B2F4A1 /* Info.plist */, 79 | ); 80 | path = HAPlayerView; 81 | sourceTree = ""; 82 | }; 83 | 0AC19E9F1E53109500B2F4A1 /* HAPlayerViewTests */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 0AC19EA01E53109500B2F4A1 /* HAPlayerViewTests.swift */, 87 | 0AC19EA21E53109500B2F4A1 /* Info.plist */, 88 | ); 89 | path = HAPlayerViewTests; 90 | sourceTree = ""; 91 | }; 92 | /* End PBXGroup section */ 93 | 94 | /* Begin PBXHeadersBuildPhase section */ 95 | 0AC19E8F1E53109500B2F4A1 /* Headers */ = { 96 | isa = PBXHeadersBuildPhase; 97 | buildActionMask = 2147483647; 98 | files = ( 99 | 0AC19EA31E53109500B2F4A1 /* HAPlayerView.h in Headers */, 100 | ); 101 | runOnlyForDeploymentPostprocessing = 0; 102 | }; 103 | /* End PBXHeadersBuildPhase section */ 104 | 105 | /* Begin PBXNativeTarget section */ 106 | 0AC19E911E53109500B2F4A1 /* HAPlayerView */ = { 107 | isa = PBXNativeTarget; 108 | buildConfigurationList = 0AC19EA61E53109500B2F4A1 /* Build configuration list for PBXNativeTarget "HAPlayerView" */; 109 | buildPhases = ( 110 | 0AC19E8D1E53109500B2F4A1 /* Sources */, 111 | 0AC19E8E1E53109500B2F4A1 /* Frameworks */, 112 | 0AC19E8F1E53109500B2F4A1 /* Headers */, 113 | 0AC19E901E53109500B2F4A1 /* Resources */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = HAPlayerView; 120 | productName = HAPlayerView; 121 | productReference = 0AC19E921E53109500B2F4A1 /* HAPlayerView.framework */; 122 | productType = "com.apple.product-type.framework"; 123 | }; 124 | 0AC19E9A1E53109500B2F4A1 /* HAPlayerViewTests */ = { 125 | isa = PBXNativeTarget; 126 | buildConfigurationList = 0AC19EA91E53109500B2F4A1 /* Build configuration list for PBXNativeTarget "HAPlayerViewTests" */; 127 | buildPhases = ( 128 | 0AC19E971E53109500B2F4A1 /* Sources */, 129 | 0AC19E981E53109500B2F4A1 /* Frameworks */, 130 | 0AC19E991E53109500B2F4A1 /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | 0AC19E9E1E53109500B2F4A1 /* PBXTargetDependency */, 136 | ); 137 | name = HAPlayerViewTests; 138 | productName = HAPlayerViewTests; 139 | productReference = 0AC19E9B1E53109500B2F4A1 /* HAPlayerViewTests.xctest */; 140 | productType = "com.apple.product-type.bundle.unit-test"; 141 | }; 142 | /* End PBXNativeTarget section */ 143 | 144 | /* Begin PBXProject section */ 145 | 0AC19E891E53109500B2F4A1 /* Project object */ = { 146 | isa = PBXProject; 147 | attributes = { 148 | LastSwiftUpdateCheck = 0820; 149 | LastUpgradeCheck = 0820; 150 | ORGANIZATIONNAME = "Hipolito Arias"; 151 | TargetAttributes = { 152 | 0AC19E911E53109500B2F4A1 = { 153 | CreatedOnToolsVersion = 8.2; 154 | DevelopmentTeam = 4U72882THN; 155 | LastSwiftMigration = 0820; 156 | ProvisioningStyle = Automatic; 157 | }; 158 | 0AC19E9A1E53109500B2F4A1 = { 159 | CreatedOnToolsVersion = 8.2; 160 | DevelopmentTeam = 4U72882THN; 161 | ProvisioningStyle = Automatic; 162 | }; 163 | }; 164 | }; 165 | buildConfigurationList = 0AC19E8C1E53109500B2F4A1 /* Build configuration list for PBXProject "HAPlayerView" */; 166 | compatibilityVersion = "Xcode 3.2"; 167 | developmentRegion = English; 168 | hasScannedForEncodings = 0; 169 | knownRegions = ( 170 | en, 171 | ); 172 | mainGroup = 0AC19E881E53109500B2F4A1; 173 | productRefGroup = 0AC19E931E53109500B2F4A1 /* Products */; 174 | projectDirPath = ""; 175 | projectRoot = ""; 176 | targets = ( 177 | 0AC19E911E53109500B2F4A1 /* HAPlayerView */, 178 | 0AC19E9A1E53109500B2F4A1 /* HAPlayerViewTests */, 179 | ); 180 | }; 181 | /* End PBXProject section */ 182 | 183 | /* Begin PBXResourcesBuildPhase section */ 184 | 0AC19E901E53109500B2F4A1 /* Resources */ = { 185 | isa = PBXResourcesBuildPhase; 186 | buildActionMask = 2147483647; 187 | files = ( 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | 0AC19E991E53109500B2F4A1 /* Resources */ = { 192 | isa = PBXResourcesBuildPhase; 193 | buildActionMask = 2147483647; 194 | files = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXSourcesBuildPhase section */ 201 | 0AC19E8D1E53109500B2F4A1 /* Sources */ = { 202 | isa = PBXSourcesBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | 0AC19EAD1E53113E00B2F4A1 /* HABackgroundPlayerView.swift in Sources */, 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | 0AC19E971E53109500B2F4A1 /* Sources */ = { 210 | isa = PBXSourcesBuildPhase; 211 | buildActionMask = 2147483647; 212 | files = ( 213 | 0AC19EA11E53109500B2F4A1 /* HAPlayerViewTests.swift in Sources */, 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | }; 217 | /* End PBXSourcesBuildPhase section */ 218 | 219 | /* Begin PBXTargetDependency section */ 220 | 0AC19E9E1E53109500B2F4A1 /* PBXTargetDependency */ = { 221 | isa = PBXTargetDependency; 222 | target = 0AC19E911E53109500B2F4A1 /* HAPlayerView */; 223 | targetProxy = 0AC19E9D1E53109500B2F4A1 /* PBXContainerItemProxy */; 224 | }; 225 | /* End PBXTargetDependency section */ 226 | 227 | /* Begin XCBuildConfiguration section */ 228 | 0AC19EA41E53109500B2F4A1 /* Debug */ = { 229 | isa = XCBuildConfiguration; 230 | buildSettings = { 231 | ALWAYS_SEARCH_USER_PATHS = NO; 232 | CLANG_ANALYZER_NONNULL = YES; 233 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 234 | CLANG_CXX_LIBRARY = "libc++"; 235 | CLANG_ENABLE_MODULES = YES; 236 | CLANG_ENABLE_OBJC_ARC = YES; 237 | CLANG_WARN_BOOL_CONVERSION = YES; 238 | CLANG_WARN_CONSTANT_CONVERSION = YES; 239 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 240 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 241 | CLANG_WARN_EMPTY_BODY = YES; 242 | CLANG_WARN_ENUM_CONVERSION = YES; 243 | CLANG_WARN_INFINITE_RECURSION = YES; 244 | CLANG_WARN_INT_CONVERSION = YES; 245 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 246 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 247 | CLANG_WARN_UNREACHABLE_CODE = YES; 248 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 249 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 250 | COPY_PHASE_STRIP = NO; 251 | CURRENT_PROJECT_VERSION = 1; 252 | DEBUG_INFORMATION_FORMAT = dwarf; 253 | ENABLE_STRICT_OBJC_MSGSEND = YES; 254 | ENABLE_TESTABILITY = YES; 255 | GCC_C_LANGUAGE_STANDARD = gnu99; 256 | GCC_DYNAMIC_NO_PIC = NO; 257 | GCC_NO_COMMON_BLOCKS = YES; 258 | GCC_OPTIMIZATION_LEVEL = 0; 259 | GCC_PREPROCESSOR_DEFINITIONS = ( 260 | "DEBUG=1", 261 | "$(inherited)", 262 | ); 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 270 | MTL_ENABLE_DEBUG_INFO = YES; 271 | ONLY_ACTIVE_ARCH = YES; 272 | SDKROOT = iphoneos; 273 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 274 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 275 | TARGETED_DEVICE_FAMILY = "1,2"; 276 | VERSIONING_SYSTEM = "apple-generic"; 277 | VERSION_INFO_PREFIX = ""; 278 | }; 279 | name = Debug; 280 | }; 281 | 0AC19EA51E53109500B2F4A1 /* Release */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ALWAYS_SEARCH_USER_PATHS = NO; 285 | CLANG_ANALYZER_NONNULL = YES; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BOOL_CONVERSION = YES; 291 | CLANG_WARN_CONSTANT_CONVERSION = YES; 292 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 293 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 294 | CLANG_WARN_EMPTY_BODY = YES; 295 | CLANG_WARN_ENUM_CONVERSION = YES; 296 | CLANG_WARN_INFINITE_RECURSION = YES; 297 | CLANG_WARN_INT_CONVERSION = YES; 298 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 299 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 300 | CLANG_WARN_UNREACHABLE_CODE = YES; 301 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 302 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 303 | COPY_PHASE_STRIP = NO; 304 | CURRENT_PROJECT_VERSION = 1; 305 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 306 | ENABLE_NS_ASSERTIONS = NO; 307 | ENABLE_STRICT_OBJC_MSGSEND = YES; 308 | GCC_C_LANGUAGE_STANDARD = gnu99; 309 | GCC_NO_COMMON_BLOCKS = YES; 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 317 | MTL_ENABLE_DEBUG_INFO = NO; 318 | SDKROOT = iphoneos; 319 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 320 | TARGETED_DEVICE_FAMILY = "1,2"; 321 | VALIDATE_PRODUCT = YES; 322 | VERSIONING_SYSTEM = "apple-generic"; 323 | VERSION_INFO_PREFIX = ""; 324 | }; 325 | name = Release; 326 | }; 327 | 0AC19EA71E53109500B2F4A1 /* Debug */ = { 328 | isa = XCBuildConfiguration; 329 | buildSettings = { 330 | CLANG_ENABLE_MODULES = YES; 331 | CODE_SIGN_IDENTITY = ""; 332 | DEFINES_MODULE = YES; 333 | DEVELOPMENT_TEAM = 4U72882THN; 334 | DYLIB_COMPATIBILITY_VERSION = 1; 335 | DYLIB_CURRENT_VERSION = 1; 336 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 337 | INFOPLIST_FILE = HAPlayerView/Info.plist; 338 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 340 | PRODUCT_BUNDLE_IDENTIFIER = MasterApps.HAPlayerView; 341 | PRODUCT_NAME = "$(TARGET_NAME)"; 342 | SKIP_INSTALL = YES; 343 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 344 | SWIFT_VERSION = 4.2; 345 | }; 346 | name = Debug; 347 | }; 348 | 0AC19EA81E53109500B2F4A1 /* Release */ = { 349 | isa = XCBuildConfiguration; 350 | buildSettings = { 351 | CLANG_ENABLE_MODULES = YES; 352 | CODE_SIGN_IDENTITY = ""; 353 | DEFINES_MODULE = YES; 354 | DEVELOPMENT_TEAM = 4U72882THN; 355 | DYLIB_COMPATIBILITY_VERSION = 1; 356 | DYLIB_CURRENT_VERSION = 1; 357 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 358 | INFOPLIST_FILE = HAPlayerView/Info.plist; 359 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 360 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 361 | PRODUCT_BUNDLE_IDENTIFIER = MasterApps.HAPlayerView; 362 | PRODUCT_NAME = "$(TARGET_NAME)"; 363 | SKIP_INSTALL = YES; 364 | SWIFT_VERSION = 4.2; 365 | }; 366 | name = Release; 367 | }; 368 | 0AC19EAA1E53109500B2F4A1 /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 372 | DEVELOPMENT_TEAM = 4U72882THN; 373 | INFOPLIST_FILE = HAPlayerViewTests/Info.plist; 374 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 375 | PRODUCT_BUNDLE_IDENTIFIER = MasterApps.HAPlayerViewTests; 376 | PRODUCT_NAME = "$(TARGET_NAME)"; 377 | SWIFT_VERSION = 3.0; 378 | }; 379 | name = Debug; 380 | }; 381 | 0AC19EAB1E53109500B2F4A1 /* Release */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 385 | DEVELOPMENT_TEAM = 4U72882THN; 386 | INFOPLIST_FILE = HAPlayerViewTests/Info.plist; 387 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 388 | PRODUCT_BUNDLE_IDENTIFIER = MasterApps.HAPlayerViewTests; 389 | PRODUCT_NAME = "$(TARGET_NAME)"; 390 | SWIFT_VERSION = 3.0; 391 | }; 392 | name = Release; 393 | }; 394 | /* End XCBuildConfiguration section */ 395 | 396 | /* Begin XCConfigurationList section */ 397 | 0AC19E8C1E53109500B2F4A1 /* Build configuration list for PBXProject "HAPlayerView" */ = { 398 | isa = XCConfigurationList; 399 | buildConfigurations = ( 400 | 0AC19EA41E53109500B2F4A1 /* Debug */, 401 | 0AC19EA51E53109500B2F4A1 /* Release */, 402 | ); 403 | defaultConfigurationIsVisible = 0; 404 | defaultConfigurationName = Release; 405 | }; 406 | 0AC19EA61E53109500B2F4A1 /* Build configuration list for PBXNativeTarget "HAPlayerView" */ = { 407 | isa = XCConfigurationList; 408 | buildConfigurations = ( 409 | 0AC19EA71E53109500B2F4A1 /* Debug */, 410 | 0AC19EA81E53109500B2F4A1 /* Release */, 411 | ); 412 | defaultConfigurationIsVisible = 0; 413 | defaultConfigurationName = Release; 414 | }; 415 | 0AC19EA91E53109500B2F4A1 /* Build configuration list for PBXNativeTarget "HAPlayerViewTests" */ = { 416 | isa = XCConfigurationList; 417 | buildConfigurations = ( 418 | 0AC19EAA1E53109500B2F4A1 /* Debug */, 419 | 0AC19EAB1E53109500B2F4A1 /* Release */, 420 | ); 421 | defaultConfigurationIsVisible = 0; 422 | defaultConfigurationName = Release; 423 | }; 424 | /* End XCConfigurationList section */ 425 | }; 426 | rootObject = 0AC19E891E53109500B2F4A1 /* Project object */; 427 | } 428 | -------------------------------------------------------------------------------- /HAPlayerView.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HAPlayerView.xcodeproj/xcshareddata/xcschemes/HAPlayerView.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 65 | 71 | 72 | 73 | 74 | 75 | 76 | 82 | 83 | 89 | 90 | 91 | 92 | 94 | 95 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /HAPlayerView.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HAPlayerView/HABackgroundPlayerView.swift: -------------------------------------------------------------------------------- 1 | 2 | import UIKit 3 | import AVFoundation 4 | 5 | @IBDesignable public class HABackgroundPlayerView: UIView { 6 | 7 | var player: AVPlayer? 8 | var avPlayerLayer: AVPlayerLayer! 9 | var videoURL: NSURL = NSURL() 10 | var cView: UIView = UIView() 11 | let screenSize = UIScreen.main.bounds 12 | 13 | @IBInspectable 14 | public var name: String = "test" { 15 | didSet { 16 | inits(resource: name, extensionFormat: mime, repeats: repeats, muted: muted, alpha: layerAlpha) 17 | } 18 | } 19 | 20 | @IBInspectable 21 | public var mime: String = "mp4" { 22 | didSet { 23 | inits(resource: name, extensionFormat: mime, repeats: repeats, muted: muted, alpha: layerAlpha) 24 | } 25 | } 26 | 27 | @IBInspectable 28 | public var repeats: Bool = true { 29 | didSet { 30 | inits(resource: name, extensionFormat: mime, repeats: repeats, muted: muted, alpha: layerAlpha) 31 | } 32 | } 33 | 34 | @IBInspectable 35 | public var muted: Bool = true { 36 | didSet { 37 | inits(resource: name, extensionFormat: mime, repeats: repeats, muted: muted, alpha: layerAlpha) 38 | } 39 | } 40 | 41 | @IBInspectable 42 | public var layerAlpha: CGFloat = 0.5 { 43 | didSet { 44 | inits(resource: name, extensionFormat: mime, repeats: repeats, muted: muted, alpha: layerAlpha) 45 | } 46 | } 47 | 48 | public override init(frame: CGRect) { 49 | super.init(frame: frame) 50 | inits(resource: name, extensionFormat: mime, repeats: repeats, muted: muted, alpha: layerAlpha) 51 | } 52 | 53 | public required init?(coder aDecoder: NSCoder) { 54 | super.init(coder: aDecoder) 55 | inits(resource: name, extensionFormat: mime, repeats: repeats, muted: muted, alpha: layerAlpha) 56 | } 57 | 58 | func inits(resource: String, extensionFormat: String, repeats: Bool, muted: Bool, alpha: CGFloat) { 59 | 60 | setLayer() 61 | 62 | guard let video = Bundle.main.url(forResource: resource, 63 | withExtension: extensionFormat) else { 64 | return 65 | } 66 | videoURL = video as NSURL 67 | 68 | if (player == nil) { 69 | player = AVPlayer(url: videoURL as URL) 70 | player?.actionAtItemEnd = .none 71 | player?.isMuted = muted 72 | 73 | avPlayerLayer = AVPlayerLayer(player: player) 74 | avPlayerLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill 75 | avPlayerLayer.zPosition = -1 76 | avPlayerLayer.frame = screenSize 77 | 78 | player?.play() 79 | 80 | layer.addSublayer(avPlayerLayer) 81 | 82 | } 83 | 84 | if repeats { 85 | NotificationCenter.default.addObserver(self, 86 | selector: #selector(loopVideo), 87 | name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, 88 | object: player?.currentItem) 89 | } 90 | 91 | } 92 | 93 | @objc func loopVideo() { 94 | player?.seek(to: CMTime.zero) 95 | player?.play() 96 | } 97 | 98 | func setLayer() { 99 | if cView.isDescendant(of: self) { 100 | cView.removeFromSuperview() 101 | } else { 102 | cView = UIView.init(frame: screenSize) 103 | cView.backgroundColor = UIColor.black 104 | cView.alpha = layerAlpha; 105 | cView.layer.zPosition = 0; 106 | self.addSubview(cView) 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /HAPlayerView/HAPlayerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // HAPlayerView.h 3 | // HAPlayerView 4 | // 5 | // Created by Hipolito Arias on 14/2/17. 6 | // Copyright © 2017 Hipolito Arias. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for HAPlayerView. 12 | FOUNDATION_EXPORT double HAPlayerViewVersionNumber; 13 | 14 | //! Project version string for HAPlayerView. 15 | FOUNDATION_EXPORT const unsigned char HAPlayerViewVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /HAPlayerView/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 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.2 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /HAPlayerViewTests/HAPlayerViewTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HAPlayerViewTests.swift 3 | // HAPlayerViewTests 4 | // 5 | // Created by Hipolito Arias on 14/2/17. 6 | // Copyright © 2017 Hipolito Arias. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import HAPlayerView 11 | 12 | class HAPlayerViewTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /HAPlayerViewTests/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 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Images/Captura de pantalla 2017-02-14 a las 18.34.58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litoarias/HAPlayerView/1e82efcbd5b9aa88546d89ff9887260a6d9d2a2a/Images/Captura de pantalla 2017-02-14 a las 18.34.58.png -------------------------------------------------------------------------------- /Images/Captura de pantalla 2017-02-14 a las 18.35.17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litoarias/HAPlayerView/1e82efcbd5b9aa88546d89ff9887260a6d9d2a2a/Images/Captura de pantalla 2017-02-14 a las 18.35.17.png -------------------------------------------------------------------------------- /Images/Captura de pantalla 2017-02-15 a las 12.00.53.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litoarias/HAPlayerView/1e82efcbd5b9aa88546d89ff9887260a6d9d2a2a/Images/Captura de pantalla 2017-02-15 a las 12.00.53.png -------------------------------------------------------------------------------- /Images/out.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/litoarias/HAPlayerView/1e82efcbd5b9aa88546d89ff9887260a6d9d2a2a/Images/out.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Lito 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HAPlayerView 2 | Easy-to-use class for inserting videos as a wallpaper without a single line of code, all managed by Interface Builder. 3 | ## Preview 4 | 5 | 6 | ## Features 7 | > - [x] [Cocoapods](https://cocoapods.org/) support 8 | > - [x] [Carthage](https://github.com/Carthage/Carthage) support 9 | > - [x] Easy implementation 10 | > - [x] *@IBInspectable* 11 | > - [x] Without writing code 12 | 13 | ##Installation 14 | 15 | ####CocoaPods: 16 | 17 | pod 'HAPlayerVideo' 18 | 19 | ####Carthage: 20 | 21 | github "litoarias/HAPlayerView" 22 | 23 | ## Usage 24 | ### Cocoapod 25 | Set **class** and **Module** 26 | 27 | 28 | 29 | Configure your mime type video, layer alpha, auto replay.. 30 | 31 | 32 | 33 | ### Carthage 34 | Set **class** and **Module**, and if not appears options on Interface builder, adding **User Defined Runtime Attributes** 35 | 36 | 37 | 38 | ## Contributing 39 | 40 | 1. Fork it ( https://github.com/[my-github-username]/HAPlayerVideo/fork ) 41 | 2. Create your feature branch (`git checkout -b my-new-feature`) 42 | 3. Commit your changes (`git commit -am 'Add some feature'`) 43 | 4. Push to the branch (`git push origin my-new-feature`) 44 | 5. Create a new Pull Request 45 | --------------------------------------------------------------------------------