├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── moayadalkouz.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── moayadalkouz.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── Example.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── moayadalkouz.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist ├── Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── Contents.json │ │ ├── full-screen.imageset │ │ │ ├── Contents.json │ │ │ └── full-screen-2.png │ │ ├── pause.imageset │ │ │ ├── Contents.json │ │ │ └── pause-512.png │ │ └── play.imageset │ │ │ ├── Contents.json │ │ │ └── play-512.png │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── PlayerView.swift │ ├── PlayerView.xib │ └── ViewController.swift ├── Podfile ├── Podfile.lock └── Pods │ ├── Local Podspecs │ └── youtube-ios-player-helper-swift.podspec.json │ ├── Manifest.lock │ ├── Pods.xcodeproj │ ├── project.pbxproj │ └── xcuserdata │ │ └── moayadalkouz.xcuserdatad │ │ └── xcschemes │ │ ├── Pods-Example.xcscheme │ │ ├── xcschememanagement.plist │ │ ├── youtube-ios-player-helper-swift-youtube-ios-player-helper-swift.xcscheme │ │ └── youtube-ios-player-helper-swift.xcscheme │ └── Target Support Files │ ├── Pods-Example │ ├── Info.plist │ ├── Pods-Example-acknowledgements.markdown │ ├── Pods-Example-acknowledgements.plist │ ├── Pods-Example-dummy.m │ ├── Pods-Example-frameworks.sh │ ├── Pods-Example-resources.sh │ ├── Pods-Example-umbrella.h │ ├── Pods-Example.debug.xcconfig │ ├── Pods-Example.modulemap │ └── Pods-Example.release.xcconfig │ └── youtube-ios-player-helper-swift │ ├── Info.plist │ ├── ResourceBundle-youtube-ios-player-helper-swift-Info.plist │ ├── youtube-ios-player-helper-swift-dummy.m │ ├── youtube-ios-player-helper-swift-prefix.pch │ ├── youtube-ios-player-helper-swift-umbrella.h │ ├── youtube-ios-player-helper-swift.modulemap │ └── youtube-ios-player-helper-swift.xcconfig ├── LICENSE ├── README.md ├── youtube-ios-player-helper-swift.podspec └── youtube-ios-player-helper-swift ├── Assets ├── YTPlayerView-iframe-player.html └── YTPlayerView-iframe-playerIPAD.html └── Classes └── YTPlayerView.swift /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 379B93BD62EA9C0FF8C354D4 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FA54B24B8A312CC01030565 /* Pods_Example.framework */; }; 11 | 88B615252105AF4F00EA3C14 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B615242105AF4F00EA3C14 /* AppDelegate.swift */; }; 12 | 88B615272105AF4F00EA3C14 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B615262105AF4F00EA3C14 /* ViewController.swift */; }; 13 | 88B6152A2105AF4F00EA3C14 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 88B615282105AF4F00EA3C14 /* Main.storyboard */; }; 14 | 88B6152C2105AF5000EA3C14 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 88B6152B2105AF5000EA3C14 /* Assets.xcassets */; }; 15 | 88B6152F2105AF5000EA3C14 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 88B6152D2105AF5000EA3C14 /* LaunchScreen.storyboard */; }; 16 | 88C57A6221218D21001E5128 /* PlayerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88C57A6121218D21001E5128 /* PlayerView.xib */; }; 17 | 88C57A6421218D34001E5128 /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88C57A6321218D34001E5128 /* PlayerView.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 22EB43C071C612E3431457E1 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; 22 | 2CED972292842D33F0DC5DC9 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; 23 | 2FA54B24B8A312CC01030565 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 88B615212105AF4F00EA3C14 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | 88B615242105AF4F00EA3C14 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | 88B615262105AF4F00EA3C14 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 27 | 88B615292105AF4F00EA3C14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | 88B6152B2105AF5000EA3C14 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | 88B6152E2105AF5000EA3C14 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | 88B615302105AF5000EA3C14 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | 88C57A6121218D21001E5128 /* PlayerView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PlayerView.xib; sourceTree = ""; }; 32 | 88C57A6321218D34001E5128 /* PlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerView.swift; sourceTree = ""; }; 33 | /* End PBXFileReference section */ 34 | 35 | /* Begin PBXFrameworksBuildPhase section */ 36 | 88B6151E2105AF4F00EA3C14 /* Frameworks */ = { 37 | isa = PBXFrameworksBuildPhase; 38 | buildActionMask = 2147483647; 39 | files = ( 40 | 379B93BD62EA9C0FF8C354D4 /* Pods_Example.framework in Frameworks */, 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | 27D1C02DC7AA0776651202DE /* Pods */ = { 48 | isa = PBXGroup; 49 | children = ( 50 | 2CED972292842D33F0DC5DC9 /* Pods-Example.debug.xcconfig */, 51 | 22EB43C071C612E3431457E1 /* Pods-Example.release.xcconfig */, 52 | ); 53 | name = Pods; 54 | sourceTree = ""; 55 | }; 56 | 88B615182105AF4F00EA3C14 = { 57 | isa = PBXGroup; 58 | children = ( 59 | 88B615232105AF4F00EA3C14 /* Example */, 60 | 88B615222105AF4F00EA3C14 /* Products */, 61 | 27D1C02DC7AA0776651202DE /* Pods */, 62 | F11D2F6D958C0DA47D30A3C5 /* Frameworks */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 88B615222105AF4F00EA3C14 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 88B615212105AF4F00EA3C14 /* Example.app */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 88B615232105AF4F00EA3C14 /* Example */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 88B615242105AF4F00EA3C14 /* AppDelegate.swift */, 78 | 88B615262105AF4F00EA3C14 /* ViewController.swift */, 79 | 88B615282105AF4F00EA3C14 /* Main.storyboard */, 80 | 88B6152B2105AF5000EA3C14 /* Assets.xcassets */, 81 | 88B6152D2105AF5000EA3C14 /* LaunchScreen.storyboard */, 82 | 88B615302105AF5000EA3C14 /* Info.plist */, 83 | 88C57A6121218D21001E5128 /* PlayerView.xib */, 84 | 88C57A6321218D34001E5128 /* PlayerView.swift */, 85 | ); 86 | path = Example; 87 | sourceTree = ""; 88 | }; 89 | F11D2F6D958C0DA47D30A3C5 /* Frameworks */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 2FA54B24B8A312CC01030565 /* Pods_Example.framework */, 93 | ); 94 | name = Frameworks; 95 | sourceTree = ""; 96 | }; 97 | /* End PBXGroup section */ 98 | 99 | /* Begin PBXNativeTarget section */ 100 | 88B615202105AF4F00EA3C14 /* Example */ = { 101 | isa = PBXNativeTarget; 102 | buildConfigurationList = 88B615332105AF5000EA3C14 /* Build configuration list for PBXNativeTarget "Example" */; 103 | buildPhases = ( 104 | 9A60CE726645B666303E292D /* [CP] Check Pods Manifest.lock */, 105 | 88B6151D2105AF4F00EA3C14 /* Sources */, 106 | 88B6151E2105AF4F00EA3C14 /* Frameworks */, 107 | 88B6151F2105AF4F00EA3C14 /* Resources */, 108 | 77B52A2690F0E34343BF1138 /* [CP] Embed Pods Frameworks */, 109 | ); 110 | buildRules = ( 111 | ); 112 | dependencies = ( 113 | ); 114 | name = Example; 115 | productName = Example; 116 | productReference = 88B615212105AF4F00EA3C14 /* Example.app */; 117 | productType = "com.apple.product-type.application"; 118 | }; 119 | /* End PBXNativeTarget section */ 120 | 121 | /* Begin PBXProject section */ 122 | 88B615192105AF4F00EA3C14 /* Project object */ = { 123 | isa = PBXProject; 124 | attributes = { 125 | LastSwiftUpdateCheck = 0940; 126 | LastUpgradeCheck = 0940; 127 | ORGANIZATIONNAME = "Moayad Al kouz"; 128 | TargetAttributes = { 129 | 88B615202105AF4F00EA3C14 = { 130 | CreatedOnToolsVersion = 9.4.1; 131 | }; 132 | }; 133 | }; 134 | buildConfigurationList = 88B6151C2105AF4F00EA3C14 /* Build configuration list for PBXProject "Example" */; 135 | compatibilityVersion = "Xcode 9.3"; 136 | developmentRegion = en; 137 | hasScannedForEncodings = 0; 138 | knownRegions = ( 139 | en, 140 | Base, 141 | ); 142 | mainGroup = 88B615182105AF4F00EA3C14; 143 | productRefGroup = 88B615222105AF4F00EA3C14 /* Products */; 144 | projectDirPath = ""; 145 | projectRoot = ""; 146 | targets = ( 147 | 88B615202105AF4F00EA3C14 /* Example */, 148 | ); 149 | }; 150 | /* End PBXProject section */ 151 | 152 | /* Begin PBXResourcesBuildPhase section */ 153 | 88B6151F2105AF4F00EA3C14 /* Resources */ = { 154 | isa = PBXResourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | 88B6152F2105AF5000EA3C14 /* LaunchScreen.storyboard in Resources */, 158 | 88B6152C2105AF5000EA3C14 /* Assets.xcassets in Resources */, 159 | 88B6152A2105AF4F00EA3C14 /* Main.storyboard in Resources */, 160 | 88C57A6221218D21001E5128 /* PlayerView.xib in Resources */, 161 | ); 162 | runOnlyForDeploymentPostprocessing = 0; 163 | }; 164 | /* End PBXResourcesBuildPhase section */ 165 | 166 | /* Begin PBXShellScriptBuildPhase section */ 167 | 77B52A2690F0E34343BF1138 /* [CP] Embed Pods Frameworks */ = { 168 | isa = PBXShellScriptBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | ); 172 | inputPaths = ( 173 | "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", 174 | "${BUILT_PRODUCTS_DIR}/youtube-ios-player-helper-swift/youtube_ios_player_helper_swift.framework", 175 | ); 176 | name = "[CP] Embed Pods Frameworks"; 177 | outputPaths = ( 178 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/youtube_ios_player_helper_swift.framework", 179 | ); 180 | runOnlyForDeploymentPostprocessing = 0; 181 | shellPath = /bin/sh; 182 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; 183 | showEnvVarsInLog = 0; 184 | }; 185 | 9A60CE726645B666303E292D /* [CP] Check Pods Manifest.lock */ = { 186 | isa = PBXShellScriptBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | ); 190 | inputPaths = ( 191 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 192 | "${PODS_ROOT}/Manifest.lock", 193 | ); 194 | name = "[CP] Check Pods Manifest.lock"; 195 | outputPaths = ( 196 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | shellPath = /bin/sh; 200 | 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"; 201 | showEnvVarsInLog = 0; 202 | }; 203 | /* End PBXShellScriptBuildPhase section */ 204 | 205 | /* Begin PBXSourcesBuildPhase section */ 206 | 88B6151D2105AF4F00EA3C14 /* Sources */ = { 207 | isa = PBXSourcesBuildPhase; 208 | buildActionMask = 2147483647; 209 | files = ( 210 | 88C57A6421218D34001E5128 /* PlayerView.swift in Sources */, 211 | 88B615272105AF4F00EA3C14 /* ViewController.swift in Sources */, 212 | 88B615252105AF4F00EA3C14 /* AppDelegate.swift in Sources */, 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXSourcesBuildPhase section */ 217 | 218 | /* Begin PBXVariantGroup section */ 219 | 88B615282105AF4F00EA3C14 /* Main.storyboard */ = { 220 | isa = PBXVariantGroup; 221 | children = ( 222 | 88B615292105AF4F00EA3C14 /* Base */, 223 | ); 224 | name = Main.storyboard; 225 | sourceTree = ""; 226 | }; 227 | 88B6152D2105AF5000EA3C14 /* LaunchScreen.storyboard */ = { 228 | isa = PBXVariantGroup; 229 | children = ( 230 | 88B6152E2105AF5000EA3C14 /* Base */, 231 | ); 232 | name = LaunchScreen.storyboard; 233 | sourceTree = ""; 234 | }; 235 | /* End PBXVariantGroup section */ 236 | 237 | /* Begin XCBuildConfiguration section */ 238 | 88B615312105AF5000EA3C14 /* Debug */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_ANALYZER_NONNULL = YES; 243 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 244 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 245 | CLANG_CXX_LIBRARY = "libc++"; 246 | CLANG_ENABLE_MODULES = YES; 247 | CLANG_ENABLE_OBJC_ARC = YES; 248 | CLANG_ENABLE_OBJC_WEAK = YES; 249 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 250 | CLANG_WARN_BOOL_CONVERSION = YES; 251 | CLANG_WARN_COMMA = YES; 252 | CLANG_WARN_CONSTANT_CONVERSION = YES; 253 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 254 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 255 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 256 | CLANG_WARN_EMPTY_BODY = YES; 257 | CLANG_WARN_ENUM_CONVERSION = YES; 258 | CLANG_WARN_INFINITE_RECURSION = YES; 259 | CLANG_WARN_INT_CONVERSION = YES; 260 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 261 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 262 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 265 | CLANG_WARN_STRICT_PROTOTYPES = YES; 266 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | CODE_SIGN_IDENTITY = "iPhone Developer"; 271 | COPY_PHASE_STRIP = NO; 272 | DEBUG_INFORMATION_FORMAT = dwarf; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | ENABLE_TESTABILITY = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu11; 276 | GCC_DYNAMIC_NO_PIC = NO; 277 | GCC_NO_COMMON_BLOCKS = YES; 278 | GCC_OPTIMIZATION_LEVEL = 0; 279 | GCC_PREPROCESSOR_DEFINITIONS = ( 280 | "DEBUG=1", 281 | "$(inherited)", 282 | ); 283 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 284 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 285 | GCC_WARN_UNDECLARED_SELECTOR = YES; 286 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 287 | GCC_WARN_UNUSED_FUNCTION = YES; 288 | GCC_WARN_UNUSED_VARIABLE = YES; 289 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 290 | MTL_ENABLE_DEBUG_INFO = YES; 291 | ONLY_ACTIVE_ARCH = YES; 292 | SDKROOT = iphoneos; 293 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 294 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 295 | }; 296 | name = Debug; 297 | }; 298 | 88B615322105AF5000EA3C14 /* Release */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ALWAYS_SEARCH_USER_PATHS = NO; 302 | CLANG_ANALYZER_NONNULL = YES; 303 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 304 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 305 | CLANG_CXX_LIBRARY = "libc++"; 306 | CLANG_ENABLE_MODULES = YES; 307 | CLANG_ENABLE_OBJC_ARC = YES; 308 | CLANG_ENABLE_OBJC_WEAK = YES; 309 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 310 | CLANG_WARN_BOOL_CONVERSION = YES; 311 | CLANG_WARN_COMMA = YES; 312 | CLANG_WARN_CONSTANT_CONVERSION = YES; 313 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 316 | CLANG_WARN_EMPTY_BODY = YES; 317 | CLANG_WARN_ENUM_CONVERSION = YES; 318 | CLANG_WARN_INFINITE_RECURSION = YES; 319 | CLANG_WARN_INT_CONVERSION = YES; 320 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 321 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 322 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 324 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 325 | CLANG_WARN_STRICT_PROTOTYPES = YES; 326 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 327 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | CODE_SIGN_IDENTITY = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 333 | ENABLE_NS_ASSERTIONS = NO; 334 | ENABLE_STRICT_OBJC_MSGSEND = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu11; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 339 | GCC_WARN_UNDECLARED_SELECTOR = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 341 | GCC_WARN_UNUSED_FUNCTION = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 344 | MTL_ENABLE_DEBUG_INFO = NO; 345 | SDKROOT = iphoneos; 346 | SWIFT_COMPILATION_MODE = wholemodule; 347 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 348 | VALIDATE_PRODUCT = YES; 349 | }; 350 | name = Release; 351 | }; 352 | 88B615342105AF5000EA3C14 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | baseConfigurationReference = 2CED972292842D33F0DC5DC9 /* Pods-Example.debug.xcconfig */; 355 | buildSettings = { 356 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 357 | CODE_SIGN_STYLE = Automatic; 358 | DEVELOPMENT_TEAM = 3XT8VQ6S4K; 359 | INFOPLIST_FILE = Example/Info.plist; 360 | LD_RUNPATH_SEARCH_PATHS = ( 361 | "$(inherited)", 362 | "@executable_path/Frameworks", 363 | ); 364 | PRODUCT_BUNDLE_IDENTIFIER = com.dopravo.Example; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | SWIFT_VERSION = 4.2; 367 | TARGETED_DEVICE_FAMILY = "1,2"; 368 | }; 369 | name = Debug; 370 | }; 371 | 88B615352105AF5000EA3C14 /* Release */ = { 372 | isa = XCBuildConfiguration; 373 | baseConfigurationReference = 22EB43C071C612E3431457E1 /* Pods-Example.release.xcconfig */; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | CODE_SIGN_STYLE = Automatic; 377 | DEVELOPMENT_TEAM = 3XT8VQ6S4K; 378 | INFOPLIST_FILE = Example/Info.plist; 379 | LD_RUNPATH_SEARCH_PATHS = ( 380 | "$(inherited)", 381 | "@executable_path/Frameworks", 382 | ); 383 | PRODUCT_BUNDLE_IDENTIFIER = com.dopravo.Example; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | SWIFT_VERSION = 4.2; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Release; 389 | }; 390 | /* End XCBuildConfiguration section */ 391 | 392 | /* Begin XCConfigurationList section */ 393 | 88B6151C2105AF4F00EA3C14 /* Build configuration list for PBXProject "Example" */ = { 394 | isa = XCConfigurationList; 395 | buildConfigurations = ( 396 | 88B615312105AF5000EA3C14 /* Debug */, 397 | 88B615322105AF5000EA3C14 /* Release */, 398 | ); 399 | defaultConfigurationIsVisible = 0; 400 | defaultConfigurationName = Release; 401 | }; 402 | 88B615332105AF5000EA3C14 /* Build configuration list for PBXNativeTarget "Example" */ = { 403 | isa = XCConfigurationList; 404 | buildConfigurations = ( 405 | 88B615342105AF5000EA3C14 /* Debug */, 406 | 88B615352105AF5000EA3C14 /* Release */, 407 | ); 408 | defaultConfigurationIsVisible = 0; 409 | defaultConfigurationName = Release; 410 | }; 411 | /* End XCConfigurationList section */ 412 | }; 413 | rootObject = 88B615192105AF4F00EA3C14 /* Project object */; 414 | } 415 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/xcuserdata/moayadalkouz.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malkouz/youtube-ios-player-helper-swift/eeffbb4cd0ba258b188f3bdce819dbdf3b60aa32/Example/Example.xcodeproj/project.xcworkspace/xcuserdata/moayadalkouz.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/Example.xcodeproj/xcuserdata/moayadalkouz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Example.xcscheme 8 | 9 | orderHint 10 | 3 11 | 12 | Example.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 3 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/xcuserdata/moayadalkouz.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malkouz/youtube-ios-player-helper-swift/eeffbb4cd0ba258b188f3bdce819dbdf3b60aa32/Example/Example.xcworkspace/xcuserdata/moayadalkouz.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Example/Example.xcworkspace/xcuserdata/moayadalkouz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 40 | 52 | 53 | 54 | 56 | 68 | 69 | 70 | 72 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by Moayad Al kouz on 7/23/18. 6 | // Copyright © 2018 Moayad Al kouz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | private 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 invalidate graphics rendering callbacks. 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 active 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/Example/Assets.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" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/full-screen.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "full-screen-2.png" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/full-screen.imageset/full-screen-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malkouz/youtube-ios-player-helper-swift/eeffbb4cd0ba258b188f3bdce819dbdf3b60aa32/Example/Example/Assets.xcassets/full-screen.imageset/full-screen-2.png -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/pause.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "pause-512.png" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/pause.imageset/pause-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malkouz/youtube-ios-player-helper-swift/eeffbb4cd0ba258b188f3bdce819dbdf3b60aa32/Example/Example/Assets.xcassets/pause.imageset/pause-512.png -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/play.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "play-512.png" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/play.imageset/play-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/malkouz/youtube-ios-player-helper-swift/eeffbb4cd0ba258b188f3bdce819dbdf3b60aa32/Example/Example/Assets.xcassets/play.imageset/play-512.png -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /Example/Example/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 | -------------------------------------------------------------------------------- /Example/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/Example/PlayerView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PlayerView.swift 3 | // Example 4 | // 5 | // Created by Moayad Al kouz on 8/13/18. 6 | // Copyright © 2018 Moayad Al kouz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import youtube_ios_player_helper_swift 11 | 12 | 13 | class PlayerView: UIView { 14 | var videoId: String = ""{ 15 | didSet{ 16 | if !videoId.isEmpty{ 17 | loadVideo() 18 | } 19 | 20 | } 21 | } 22 | 23 | 24 | @IBOutlet weak var ytPlayerView: YTPlayerView! 25 | @IBOutlet weak var btnPlayPause: UIButton! 26 | @IBOutlet weak var btnFullScreen: UIButton! 27 | 28 | @IBOutlet weak var timeSlider: UISlider!{ 29 | didSet{ 30 | self.timeSlider.addTarget(self, action: #selector(sliderValueChanged), for: .valueChanged) 31 | self.timeSlider.addTarget(self, action: #selector(startEditingSlider), for: .touchDown) 32 | self.timeSlider.addTarget(self, action: #selector(stopEditingSlider), for: [.touchUpInside, .touchUpOutside]) 33 | self.timeSlider.value = 0.0 34 | } 35 | } 36 | 37 | @IBOutlet weak var currentTimeLabel: UILabel! 38 | @IBOutlet weak var remainingTimeLabel: UILabel! 39 | @IBOutlet weak var controlsView: UIView! 40 | 41 | private var isFullScreen = false 42 | 43 | private func loadVideo(){ 44 | let playerVars:[String: Any] = [ 45 | "controls" : "0", 46 | "showinfo" : "0", 47 | "autoplay": "0", 48 | "rel": "0", 49 | "modestbranding": "0", 50 | "iv_load_policy" : "3", 51 | "fs": "0", 52 | "playsinline" : "1" 53 | ] 54 | ytPlayerView.delegate = self 55 | _ = ytPlayerView.load(videoId: videoId, playerVars: playerVars) 56 | ytPlayerView.isUserInteractionEnabled = false 57 | updateTime() 58 | } 59 | 60 | 61 | 62 | @IBAction func toogleFullScreen(sender: UIButton){ 63 | guard let rootVC = UIApplication.shared.delegate?.window??.rootViewController else { 64 | return 65 | } 66 | isFullScreen = !isFullScreen 67 | if isFullScreen{ 68 | let landscape = LandscapeViewController() 69 | landscape.view = self 70 | 71 | rootVC.present(landscape, animated: false, completion: nil) 72 | }else{ 73 | rootVC.presentedViewController?.dismiss(animated: false, completion: nil) 74 | } 75 | } 76 | 77 | @IBAction func playStop(sender: UIButton){ 78 | if ytPlayerView.playerState == .playing{ 79 | ytPlayerView.stopVideo() 80 | sender.setImage(#imageLiteral(resourceName: "play"), for: .normal) 81 | }else{ 82 | ytPlayerView.playVideo() 83 | sender.setImage(#imageLiteral(resourceName: "pause"), for: .normal) 84 | } 85 | } 86 | 87 | func secondsToHoursMinutesSeconds (_ seconds : Int) -> (hours : Int, minutes : Int, seconds : Int) { 88 | return (seconds / 3600, (seconds % 3600) / 60, (seconds % 3600) % 60) 89 | } 90 | 91 | func paddedNumber(_ number : Int) -> String{ 92 | if(number < 0){ 93 | return "00" 94 | }else if(number < 10){ 95 | return "0\(number)" 96 | }else{ 97 | return String(number) 98 | } 99 | } 100 | 101 | func ytk_secondsToCounter(_ seconds : Int) -> String { 102 | 103 | let time = self.secondsToHoursMinutesSeconds(seconds) 104 | 105 | let minutesSeconds = "\(self.paddedNumber(time.minutes)):\(self.paddedNumber(time.seconds))" 106 | 107 | if(time.hours == 0){ 108 | return minutesSeconds 109 | }else{ 110 | return "\(self.paddedNumber(time.hours)):\(minutesSeconds)" 111 | } 112 | 113 | } 114 | 115 | @objc func sliderValueChanged(){ 116 | 117 | 118 | let duration = ytPlayerView.duration 119 | 120 | let currentTime = Int(Double(self.timeSlider.value) * duration) 121 | self.currentTimeLabel.text = self.ytk_secondsToCounter(currentTime) 122 | 123 | let timeLeft = Int(duration) - currentTime 124 | self.remainingTimeLabel.text = "-\(self.ytk_secondsToCounter(timeLeft))" 125 | 126 | } 127 | 128 | @objc func stopEditingSlider(){ 129 | let duration = Float(ytPlayerView.duration) 130 | 131 | let seconds = self.timeSlider.value * duration 132 | 133 | self.ytPlayerView.playVideo() 134 | // self.playerView.seekTo(seconds: seconds, seekAhead: true) 135 | self.ytPlayerView.seek(seekToSeconds: seconds, allowSeekAhead: true) 136 | } 137 | 138 | @objc func startEditingSlider(){ 139 | self.ytPlayerView.pauseVideo() 140 | } 141 | 142 | @objc func updateTime(){ 143 | let currentTime = ytPlayerView.currentTime 144 | let duration = Float( ytPlayerView.duration ) 145 | 146 | let progress = currentTime / duration 147 | self.timeSlider.value = progress 148 | self.timeSlider.sendActions(for: .valueChanged) 149 | 150 | 151 | self.perform(#selector(updateTime), with: nil, afterDelay: 1.0) 152 | } 153 | 154 | } 155 | 156 | class LandscapeViewController: UIViewController { 157 | 158 | override var shouldAutorotate: Bool{ 159 | return false 160 | } 161 | 162 | override var supportedInterfaceOrientations: UIInterfaceOrientationMask{ 163 | return .landscape 164 | } 165 | } 166 | 167 | 168 | extension PlayerView: YTPlayerViewDelegate{ 169 | func playerViewDidBecomeReady(_ playerView: YTPlayerView) { 170 | playerView.playVideo() 171 | btnPlayPause.setImage(#imageLiteral(resourceName: "pause"), for: .normal) 172 | } 173 | 174 | func playerView(_ playerView: YTPlayerView, didChangeTo quality: YTPlaybackQuality) { 175 | print("Quality :: ", quality) 176 | } 177 | 178 | // func playerViewPreferredInitialLoadingView(_ playerView: YTPlayerView) -> UIView? { 179 | // let loader = UIView(frame: CGRect(x: 10, y: 10, width: 200, height: 200)) 180 | // loader.backgroundColor = UIColor.brown 181 | // return loader 182 | // } 183 | } 184 | -------------------------------------------------------------------------------- /Example/Example/PlayerView.xib: -------------------------------------------------------------------------------- 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 | 40 | 51 | 62 | 63 | 64 | 65 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Created by Moayad Al kouz on 7/23/18. 6 | // Copyright © 2018 Moayad Al kouz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import youtube_ios_player_helper_swift 11 | 12 | class ViewController: UIViewController { 13 | 14 | private var playerView: PlayerView! 15 | 16 | override var supportedInterfaceOrientations: UIInterfaceOrientationMask{ 17 | return .portrait 18 | } 19 | 20 | override var shouldAutorotate: Bool{ 21 | return false 22 | } 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | 27 | playerView = UINib(nibName: "PlayerView", bundle: nil).instantiate(withOwner: nil, options: nil)[0] as? PlayerView 28 | playerView.videoId = "ie8JQLLisao" 29 | 30 | // Do any additional setup after loading the view, typically from a nib. 31 | } 32 | 33 | override func viewDidAppear(_ animated: Bool) { 34 | super.viewDidAppear(animated) 35 | addPlayerView() 36 | } 37 | 38 | private func addPlayerView(){ 39 | self.view.addSubview(playerView) 40 | playerView.frame = CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 240) 41 | playerView.autoresizingMask = .flexibleWidth 42 | } 43 | 44 | 45 | 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | platform :ios, '8.0' 3 | 4 | target 'Example' do 5 | pod 'youtube-ios-player-helper-swift', :path => '../' 6 | 7 | 8 | end 9 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - youtube-ios-player-helper-swift (1.0) 3 | 4 | DEPENDENCIES: 5 | - youtube-ios-player-helper-swift (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | youtube-ios-player-helper-swift: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | youtube-ios-player-helper-swift: 7fb7286bc55156a4e657737bb22de2c4a48438ae 13 | 14 | PODFILE CHECKSUM: 263ac91ba3d4d23c6db02170ac4dec9689b60e1c 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/youtube-ios-player-helper-swift.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "youtube-ios-player-helper-swift", 3 | "version": "1.0", 4 | "summary": "Helper library for iOS developers looking to add YouTube video playback in their applications via the iframe player in a UIWebView.", 5 | "description": "A full swift implementation of https://github.com/youtube/youtube-ios-player-helper. Helper library for iOS developers looking to add YouTube video playback in their applications via the iframe player in a UIWebView.", 6 | "homepage": "https://github.com/malkouz/youtube-ios-player-helper-swift", 7 | "license": { 8 | "type": "Apache License 2.0", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "Moayad Al kouz": "moayad_kouz9@hotmail.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/malkouz/youtube-ios-player-helper-swift.git", 16 | "tag": "1.0" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "youtube-ios-player-helper-swift/Classes/**/*", 22 | "resource_bundles": { 23 | "youtube-ios-player-helper-swift": [ 24 | "youtube-ios-player-helper-swift/Assets/*" 25 | ] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - youtube-ios-player-helper-swift (1.0) 3 | 4 | DEPENDENCIES: 5 | - youtube-ios-player-helper-swift (from `../`) 6 | 7 | EXTERNAL SOURCES: 8 | youtube-ios-player-helper-swift: 9 | :path: "../" 10 | 11 | SPEC CHECKSUMS: 12 | youtube-ios-player-helper-swift: 7fb7286bc55156a4e657737bb22de2c4a48438ae 13 | 14 | PODFILE CHECKSUM: 263ac91ba3d4d23c6db02170ac4dec9689b60e1c 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1F3784AB7B3EF9DC9384A0025948FD28 /* Pods-Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 15D3FE98E9F2D34863BD3F3597A0485A /* Pods-Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 11 | 440FF7DD3E06DB0235AC0A8A6E33E209 /* youtube-ios-player-helper-swift.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B3B7A1FB2F746817268A93D7AAF6BBF1 /* youtube-ios-player-helper-swift.bundle */; }; 12 | 4FDD74948AF4C06F7E50FF2BC3FA00C8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; 13 | 800CFCBE60E249A3EDD5149A39ED8156 /* YTPlayerView-iframe-playerIPAD.html in Resources */ = {isa = PBXBuildFile; fileRef = EC54A75000F930A072698162DE52B9A2 /* YTPlayerView-iframe-playerIPAD.html */; }; 14 | 8245AEB8A5DAC10397744624B4EE3657 /* YTPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CB834EF7A079367C96F73875427B143 /* YTPlayerView.swift */; }; 15 | 8B73D9BFDFC1678C3E7547CEE23E7E7C /* Pods-Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AD65E35A3233FBE6F2EFDEB3D43D114 /* Pods-Example-dummy.m */; }; 16 | BE46719A6F55EC195A091DA8F6B8040B /* youtube-ios-player-helper-swift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A0A3BCEAF010474B119D9B2727CA886 /* youtube-ios-player-helper-swift-dummy.m */; }; 17 | C65B9DA22255DED818868B08E59AE30B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; 18 | E4368025242AEA0CD13739E11F5E1A6D /* youtube-ios-player-helper-swift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 61F438952EA286E91151636F3734B161 /* youtube-ios-player-helper-swift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; 19 | EA5ED7D9BBA6E9E9430F57B7550F9BF4 /* YTPlayerView-iframe-player.html in Resources */ = {isa = PBXBuildFile; fileRef = A6E7A0CF72760FB216233AD1ADA9CD0B /* YTPlayerView-iframe-player.html */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 0067618C68DF40BC2F71C1C00F8C3356 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 7272EFE6BF19313CECBAAA5E23472511; 28 | remoteInfo = "youtube-ios-player-helper-swift-youtube-ios-player-helper-swift"; 29 | }; 30 | B17410995299F61633A03AD49B215B4D /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 8B3395ADCA39C1F529F948C416CC7658; 35 | remoteInfo = "youtube-ios-player-helper-swift"; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 044AA3E23F71470C9B5F50D44720EA0D /* Pods-Example-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Example-resources.sh"; sourceTree = ""; }; 41 | 0EBD99012BD8EE2D792DADF6ADC0BF20 /* ResourceBundle-youtube-ios-player-helper-swift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-youtube-ios-player-helper-swift-Info.plist"; sourceTree = ""; }; 42 | 11434BC759D12F57876FBB74A4775E74 /* Pods-Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Example-acknowledgements.plist"; sourceTree = ""; }; 43 | 15D3FE98E9F2D34863BD3F3597A0485A /* Pods-Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Example-umbrella.h"; sourceTree = ""; }; 44 | 19EAE52BF03701E8D794E3F623E568BF /* youtube_ios_player_helper_swift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = youtube_ios_player_helper_swift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 1AD65E35A3233FBE6F2EFDEB3D43D114 /* Pods-Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Example-dummy.m"; sourceTree = ""; }; 46 | 222AB19BC96CB2FCB2B0A4793DC96488 /* youtube-ios-player-helper-swift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "youtube-ios-player-helper-swift-prefix.pch"; sourceTree = ""; }; 47 | 25A37D4D536CC5988A439441117C41F4 /* Pods-Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-Example.modulemap"; sourceTree = ""; }; 48 | 3ADE9E5655579DB0F79DC9C80758673C /* Pods-Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Example-acknowledgements.markdown"; sourceTree = ""; }; 49 | 3F3EFEBDE6702DEFDFFF9D5C6DBC3773 /* Pods-Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Example-frameworks.sh"; sourceTree = ""; }; 50 | 4CB834EF7A079367C96F73875427B143 /* YTPlayerView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = YTPlayerView.swift; path = "youtube-ios-player-helper-swift/Classes/YTPlayerView.swift"; sourceTree = ""; }; 51 | 5A0A3BCEAF010474B119D9B2727CA886 /* youtube-ios-player-helper-swift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "youtube-ios-player-helper-swift-dummy.m"; sourceTree = ""; }; 52 | 5B81C04F8E84EAE60AE15C8695031A5F /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 53 | 61F438952EA286E91151636F3734B161 /* youtube-ios-player-helper-swift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "youtube-ios-player-helper-swift-umbrella.h"; sourceTree = ""; }; 54 | 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 55 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 56 | 9D4AD032A5C9F70E56A5FB29F83DC6E5 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | A2149ED5667D2A2135F36936B00D3636 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | A6E7A0CF72760FB216233AD1ADA9CD0B /* YTPlayerView-iframe-player.html */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.html; name = "YTPlayerView-iframe-player.html"; path = "youtube-ios-player-helper-swift/Assets/YTPlayerView-iframe-player.html"; sourceTree = ""; }; 59 | A79AC23D5A157FED70D9C53D844B2319 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Example.release.xcconfig"; sourceTree = ""; }; 60 | B15FD3F701D813201488968B2484746B /* youtube-ios-player-helper-swift.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; path = "youtube-ios-player-helper-swift.podspec"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 61 | B3B7A1FB2F746817268A93D7AAF6BBF1 /* youtube-ios-player-helper-swift.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "youtube-ios-player-helper-swift.bundle"; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | DDC6BDC1A5A2081962364D7F3E04775F /* youtube-ios-player-helper-swift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "youtube-ios-player-helper-swift.modulemap"; sourceTree = ""; }; 63 | EC54A75000F930A072698162DE52B9A2 /* YTPlayerView-iframe-playerIPAD.html */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.html; name = "YTPlayerView-iframe-playerIPAD.html"; path = "youtube-ios-player-helper-swift/Assets/YTPlayerView-iframe-playerIPAD.html"; sourceTree = ""; }; 64 | EFC5B2E05B58CD826FD55659BF1D7E39 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Example.debug.xcconfig"; sourceTree = ""; }; 65 | F578B84DB921DA1601FE66E8F52D6B5F /* youtube-ios-player-helper-swift.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "youtube-ios-player-helper-swift.xcconfig"; sourceTree = ""; }; 66 | /* End PBXFileReference section */ 67 | 68 | /* Begin PBXFrameworksBuildPhase section */ 69 | 15EF0AC426C91013A70A9E0DC10A054D /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | 4A9D1915EB90C7AA6E6D9CF3B776A463 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | C65B9DA22255DED818868B08E59AE30B /* Foundation.framework in Frameworks */, 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | C23B28E678599AB335FC7B482335B154 /* Frameworks */ = { 85 | isa = PBXFrameworksBuildPhase; 86 | buildActionMask = 2147483647; 87 | files = ( 88 | 4FDD74948AF4C06F7E50FF2BC3FA00C8 /* Foundation.framework in Frameworks */, 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | /* End PBXFrameworksBuildPhase section */ 93 | 94 | /* Begin PBXGroup section */ 95 | 1B5ECB992A56AE0C70DC72D88BB90B05 /* Pods-Example */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 5B81C04F8E84EAE60AE15C8695031A5F /* Info.plist */, 99 | 25A37D4D536CC5988A439441117C41F4 /* Pods-Example.modulemap */, 100 | 3ADE9E5655579DB0F79DC9C80758673C /* Pods-Example-acknowledgements.markdown */, 101 | 11434BC759D12F57876FBB74A4775E74 /* Pods-Example-acknowledgements.plist */, 102 | 1AD65E35A3233FBE6F2EFDEB3D43D114 /* Pods-Example-dummy.m */, 103 | 3F3EFEBDE6702DEFDFFF9D5C6DBC3773 /* Pods-Example-frameworks.sh */, 104 | 044AA3E23F71470C9B5F50D44720EA0D /* Pods-Example-resources.sh */, 105 | 15D3FE98E9F2D34863BD3F3597A0485A /* Pods-Example-umbrella.h */, 106 | EFC5B2E05B58CD826FD55659BF1D7E39 /* Pods-Example.debug.xcconfig */, 107 | A79AC23D5A157FED70D9C53D844B2319 /* Pods-Example.release.xcconfig */, 108 | ); 109 | name = "Pods-Example"; 110 | path = "Target Support Files/Pods-Example"; 111 | sourceTree = ""; 112 | }; 113 | 5A511C89313DEEDF805232CE8E7EB317 /* Development Pods */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 6D636CD6FAC09C57265B113714767A45 /* youtube-ios-player-helper-swift */, 117 | ); 118 | name = "Development Pods"; 119 | sourceTree = ""; 120 | }; 121 | 5BC4CA015ADD179517386F4F348610BF /* Support Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 9D4AD032A5C9F70E56A5FB29F83DC6E5 /* Info.plist */, 125 | 0EBD99012BD8EE2D792DADF6ADC0BF20 /* ResourceBundle-youtube-ios-player-helper-swift-Info.plist */, 126 | DDC6BDC1A5A2081962364D7F3E04775F /* youtube-ios-player-helper-swift.modulemap */, 127 | F578B84DB921DA1601FE66E8F52D6B5F /* youtube-ios-player-helper-swift.xcconfig */, 128 | 5A0A3BCEAF010474B119D9B2727CA886 /* youtube-ios-player-helper-swift-dummy.m */, 129 | 222AB19BC96CB2FCB2B0A4793DC96488 /* youtube-ios-player-helper-swift-prefix.pch */, 130 | 61F438952EA286E91151636F3734B161 /* youtube-ios-player-helper-swift-umbrella.h */, 131 | ); 132 | name = "Support Files"; 133 | path = "Example/Pods/Target Support Files/youtube-ios-player-helper-swift"; 134 | sourceTree = ""; 135 | }; 136 | 6A4F6A14E3FB951290E4531728B7A461 /* Targets Support Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 1B5ECB992A56AE0C70DC72D88BB90B05 /* Pods-Example */, 140 | ); 141 | name = "Targets Support Files"; 142 | sourceTree = ""; 143 | }; 144 | 6D636CD6FAC09C57265B113714767A45 /* youtube-ios-player-helper-swift */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 4CB834EF7A079367C96F73875427B143 /* YTPlayerView.swift */, 148 | 98DC99E84BE6AE6018715502948AD10E /* Pod */, 149 | B29ED555D319527B0A707FA184831196 /* Resources */, 150 | 5BC4CA015ADD179517386F4F348610BF /* Support Files */, 151 | ); 152 | name = "youtube-ios-player-helper-swift"; 153 | path = ../..; 154 | sourceTree = ""; 155 | }; 156 | 7DB346D0F39D3F0E887471402A8071AB = { 157 | isa = PBXGroup; 158 | children = ( 159 | 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, 160 | 5A511C89313DEEDF805232CE8E7EB317 /* Development Pods */, 161 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, 162 | A97A2A9AE43B3A39D0A471A1033DD689 /* Products */, 163 | 6A4F6A14E3FB951290E4531728B7A461 /* Targets Support Files */, 164 | ); 165 | sourceTree = ""; 166 | }; 167 | 98DC99E84BE6AE6018715502948AD10E /* Pod */ = { 168 | isa = PBXGroup; 169 | children = ( 170 | B15FD3F701D813201488968B2484746B /* youtube-ios-player-helper-swift.podspec */, 171 | ); 172 | name = Pod; 173 | sourceTree = ""; 174 | }; 175 | A97A2A9AE43B3A39D0A471A1033DD689 /* Products */ = { 176 | isa = PBXGroup; 177 | children = ( 178 | A2149ED5667D2A2135F36936B00D3636 /* Pods_Example.framework */, 179 | B3B7A1FB2F746817268A93D7AAF6BBF1 /* youtube-ios-player-helper-swift.bundle */, 180 | 19EAE52BF03701E8D794E3F623E568BF /* youtube_ios_player_helper_swift.framework */, 181 | ); 182 | name = Products; 183 | sourceTree = ""; 184 | }; 185 | B29ED555D319527B0A707FA184831196 /* Resources */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | A6E7A0CF72760FB216233AD1ADA9CD0B /* YTPlayerView-iframe-player.html */, 189 | EC54A75000F930A072698162DE52B9A2 /* YTPlayerView-iframe-playerIPAD.html */, 190 | ); 191 | name = Resources; 192 | sourceTree = ""; 193 | }; 194 | BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | D35AF013A5F0BAD4F32504907A52519E /* iOS */, 198 | ); 199 | name = Frameworks; 200 | sourceTree = ""; 201 | }; 202 | D35AF013A5F0BAD4F32504907A52519E /* iOS */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */, 206 | ); 207 | name = iOS; 208 | sourceTree = ""; 209 | }; 210 | /* End PBXGroup section */ 211 | 212 | /* Begin PBXHeadersBuildPhase section */ 213 | 123D585CD19D7983F8EB9A72706B6506 /* Headers */ = { 214 | isa = PBXHeadersBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | E4368025242AEA0CD13739E11F5E1A6D /* youtube-ios-player-helper-swift-umbrella.h in Headers */, 218 | ); 219 | runOnlyForDeploymentPostprocessing = 0; 220 | }; 221 | 1633FFC05B354E08D739FB8851FCDF62 /* Headers */ = { 222 | isa = PBXHeadersBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | 1F3784AB7B3EF9DC9384A0025948FD28 /* Pods-Example-umbrella.h in Headers */, 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | /* End PBXHeadersBuildPhase section */ 230 | 231 | /* Begin PBXNativeTarget section */ 232 | 7272EFE6BF19313CECBAAA5E23472511 /* youtube-ios-player-helper-swift-youtube-ios-player-helper-swift */ = { 233 | isa = PBXNativeTarget; 234 | buildConfigurationList = 177F292D41CBBB0A04FE205CECE40A44 /* Build configuration list for PBXNativeTarget "youtube-ios-player-helper-swift-youtube-ios-player-helper-swift" */; 235 | buildPhases = ( 236 | 1CBFB6CFCD3DCE08BE8A4F13B2E3F86D /* Sources */, 237 | 15EF0AC426C91013A70A9E0DC10A054D /* Frameworks */, 238 | 161B3CAC66EA4814DDD3216115040336 /* Resources */, 239 | ); 240 | buildRules = ( 241 | ); 242 | dependencies = ( 243 | ); 244 | name = "youtube-ios-player-helper-swift-youtube-ios-player-helper-swift"; 245 | productName = "youtube-ios-player-helper-swift-youtube-ios-player-helper-swift"; 246 | productReference = B3B7A1FB2F746817268A93D7AAF6BBF1 /* youtube-ios-player-helper-swift.bundle */; 247 | productType = "com.apple.product-type.bundle"; 248 | }; 249 | 7666DF02CF0ACE5DE38C279437CA5EE4 /* Pods-Example */ = { 250 | isa = PBXNativeTarget; 251 | buildConfigurationList = EF3576272239D81BEF9169CDCE96634E /* Build configuration list for PBXNativeTarget "Pods-Example" */; 252 | buildPhases = ( 253 | 8E1A9C08EA021DC3215DA8FD996A085C /* Sources */, 254 | C23B28E678599AB335FC7B482335B154 /* Frameworks */, 255 | 1633FFC05B354E08D739FB8851FCDF62 /* Headers */, 256 | ); 257 | buildRules = ( 258 | ); 259 | dependencies = ( 260 | E47C00340B6AD6C7D882BDA5327C5E57 /* PBXTargetDependency */, 261 | ); 262 | name = "Pods-Example"; 263 | productName = "Pods-Example"; 264 | productReference = A2149ED5667D2A2135F36936B00D3636 /* Pods_Example.framework */; 265 | productType = "com.apple.product-type.framework"; 266 | }; 267 | 8B3395ADCA39C1F529F948C416CC7658 /* youtube-ios-player-helper-swift */ = { 268 | isa = PBXNativeTarget; 269 | buildConfigurationList = DB821E516FEE2C73D88BC12B33250F91 /* Build configuration list for PBXNativeTarget "youtube-ios-player-helper-swift" */; 270 | buildPhases = ( 271 | 1D7E87417D933F354679D06508534919 /* Sources */, 272 | 4A9D1915EB90C7AA6E6D9CF3B776A463 /* Frameworks */, 273 | AD2FBD3DBCED54EB2765A7D51E91E14D /* Resources */, 274 | 123D585CD19D7983F8EB9A72706B6506 /* Headers */, 275 | ); 276 | buildRules = ( 277 | ); 278 | dependencies = ( 279 | 3C48ACDDF00BDA665E39D02519BAFFD4 /* PBXTargetDependency */, 280 | ); 281 | name = "youtube-ios-player-helper-swift"; 282 | productName = "youtube-ios-player-helper-swift"; 283 | productReference = 19EAE52BF03701E8D794E3F623E568BF /* youtube_ios_player_helper_swift.framework */; 284 | productType = "com.apple.product-type.framework"; 285 | }; 286 | /* End PBXNativeTarget section */ 287 | 288 | /* Begin PBXProject section */ 289 | D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { 290 | isa = PBXProject; 291 | attributes = { 292 | LastSwiftUpdateCheck = 0930; 293 | LastUpgradeCheck = 1010; 294 | }; 295 | buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; 296 | compatibilityVersion = "Xcode 3.2"; 297 | developmentRegion = English; 298 | hasScannedForEncodings = 0; 299 | knownRegions = ( 300 | en, 301 | ); 302 | mainGroup = 7DB346D0F39D3F0E887471402A8071AB; 303 | productRefGroup = A97A2A9AE43B3A39D0A471A1033DD689 /* Products */; 304 | projectDirPath = ""; 305 | projectRoot = ""; 306 | targets = ( 307 | 7666DF02CF0ACE5DE38C279437CA5EE4 /* Pods-Example */, 308 | 8B3395ADCA39C1F529F948C416CC7658 /* youtube-ios-player-helper-swift */, 309 | 7272EFE6BF19313CECBAAA5E23472511 /* youtube-ios-player-helper-swift-youtube-ios-player-helper-swift */, 310 | ); 311 | }; 312 | /* End PBXProject section */ 313 | 314 | /* Begin PBXResourcesBuildPhase section */ 315 | 161B3CAC66EA4814DDD3216115040336 /* Resources */ = { 316 | isa = PBXResourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | EA5ED7D9BBA6E9E9430F57B7550F9BF4 /* YTPlayerView-iframe-player.html in Resources */, 320 | 800CFCBE60E249A3EDD5149A39ED8156 /* YTPlayerView-iframe-playerIPAD.html in Resources */, 321 | ); 322 | runOnlyForDeploymentPostprocessing = 0; 323 | }; 324 | AD2FBD3DBCED54EB2765A7D51E91E14D /* Resources */ = { 325 | isa = PBXResourcesBuildPhase; 326 | buildActionMask = 2147483647; 327 | files = ( 328 | 440FF7DD3E06DB0235AC0A8A6E33E209 /* youtube-ios-player-helper-swift.bundle in Resources */, 329 | ); 330 | runOnlyForDeploymentPostprocessing = 0; 331 | }; 332 | /* End PBXResourcesBuildPhase section */ 333 | 334 | /* Begin PBXSourcesBuildPhase section */ 335 | 1CBFB6CFCD3DCE08BE8A4F13B2E3F86D /* Sources */ = { 336 | isa = PBXSourcesBuildPhase; 337 | buildActionMask = 2147483647; 338 | files = ( 339 | ); 340 | runOnlyForDeploymentPostprocessing = 0; 341 | }; 342 | 1D7E87417D933F354679D06508534919 /* Sources */ = { 343 | isa = PBXSourcesBuildPhase; 344 | buildActionMask = 2147483647; 345 | files = ( 346 | BE46719A6F55EC195A091DA8F6B8040B /* youtube-ios-player-helper-swift-dummy.m in Sources */, 347 | 8245AEB8A5DAC10397744624B4EE3657 /* YTPlayerView.swift in Sources */, 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | }; 351 | 8E1A9C08EA021DC3215DA8FD996A085C /* Sources */ = { 352 | isa = PBXSourcesBuildPhase; 353 | buildActionMask = 2147483647; 354 | files = ( 355 | 8B73D9BFDFC1678C3E7547CEE23E7E7C /* Pods-Example-dummy.m in Sources */, 356 | ); 357 | runOnlyForDeploymentPostprocessing = 0; 358 | }; 359 | /* End PBXSourcesBuildPhase section */ 360 | 361 | /* Begin PBXTargetDependency section */ 362 | 3C48ACDDF00BDA665E39D02519BAFFD4 /* PBXTargetDependency */ = { 363 | isa = PBXTargetDependency; 364 | name = "youtube-ios-player-helper-swift-youtube-ios-player-helper-swift"; 365 | target = 7272EFE6BF19313CECBAAA5E23472511 /* youtube-ios-player-helper-swift-youtube-ios-player-helper-swift */; 366 | targetProxy = 0067618C68DF40BC2F71C1C00F8C3356 /* PBXContainerItemProxy */; 367 | }; 368 | E47C00340B6AD6C7D882BDA5327C5E57 /* PBXTargetDependency */ = { 369 | isa = PBXTargetDependency; 370 | name = "youtube-ios-player-helper-swift"; 371 | target = 8B3395ADCA39C1F529F948C416CC7658 /* youtube-ios-player-helper-swift */; 372 | targetProxy = B17410995299F61633A03AD49B215B4D /* PBXContainerItemProxy */; 373 | }; 374 | /* End PBXTargetDependency section */ 375 | 376 | /* Begin XCBuildConfiguration section */ 377 | 1EE19F5DD95931924296F637BF18BD8F /* Debug */ = { 378 | isa = XCBuildConfiguration; 379 | buildSettings = { 380 | ALWAYS_SEARCH_USER_PATHS = NO; 381 | CLANG_ANALYZER_NONNULL = YES; 382 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 383 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 384 | CLANG_CXX_LIBRARY = "libc++"; 385 | CLANG_ENABLE_MODULES = YES; 386 | CLANG_ENABLE_OBJC_ARC = YES; 387 | CLANG_ENABLE_OBJC_WEAK = YES; 388 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 389 | CLANG_WARN_BOOL_CONVERSION = YES; 390 | CLANG_WARN_COMMA = YES; 391 | CLANG_WARN_CONSTANT_CONVERSION = YES; 392 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 393 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 394 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 395 | CLANG_WARN_EMPTY_BODY = YES; 396 | CLANG_WARN_ENUM_CONVERSION = YES; 397 | CLANG_WARN_INFINITE_RECURSION = YES; 398 | CLANG_WARN_INT_CONVERSION = YES; 399 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 400 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 401 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 402 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 403 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 404 | CLANG_WARN_STRICT_PROTOTYPES = YES; 405 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 406 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 407 | CLANG_WARN_UNREACHABLE_CODE = YES; 408 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 409 | CODE_SIGNING_ALLOWED = NO; 410 | CODE_SIGNING_REQUIRED = NO; 411 | COPY_PHASE_STRIP = NO; 412 | DEBUG_INFORMATION_FORMAT = dwarf; 413 | ENABLE_STRICT_OBJC_MSGSEND = YES; 414 | ENABLE_TESTABILITY = YES; 415 | GCC_C_LANGUAGE_STANDARD = gnu11; 416 | GCC_DYNAMIC_NO_PIC = NO; 417 | GCC_NO_COMMON_BLOCKS = YES; 418 | GCC_OPTIMIZATION_LEVEL = 0; 419 | GCC_PREPROCESSOR_DEFINITIONS = ( 420 | "POD_CONFIGURATION_DEBUG=1", 421 | "DEBUG=1", 422 | "$(inherited)", 423 | ); 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = YES; 432 | ONLY_ACTIVE_ARCH = YES; 433 | PRODUCT_NAME = "$(TARGET_NAME)"; 434 | STRIP_INSTALLED_PRODUCT = NO; 435 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 436 | SYMROOT = "${SRCROOT}/../build"; 437 | }; 438 | name = Debug; 439 | }; 440 | 3CFEB464668A0F3350F1C7D0EEB33FF9 /* Debug */ = { 441 | isa = XCBuildConfiguration; 442 | baseConfigurationReference = EFC5B2E05B58CD826FD55659BF1D7E39 /* Pods-Example.debug.xcconfig */; 443 | buildSettings = { 444 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; 445 | CODE_SIGN_IDENTITY = ""; 446 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 447 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 448 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 449 | CURRENT_PROJECT_VERSION = 1; 450 | DEFINES_MODULE = YES; 451 | DYLIB_COMPATIBILITY_VERSION = 1; 452 | DYLIB_CURRENT_VERSION = 1; 453 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 454 | INFOPLIST_FILE = "Target Support Files/Pods-Example/Info.plist"; 455 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 456 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 457 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 458 | MACH_O_TYPE = staticlib; 459 | MODULEMAP_FILE = "Target Support Files/Pods-Example/Pods-Example.modulemap"; 460 | OTHER_LDFLAGS = ""; 461 | OTHER_LIBTOOLFLAGS = ""; 462 | PODS_ROOT = "$(SRCROOT)"; 463 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 464 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 465 | SDKROOT = iphoneos; 466 | SKIP_INSTALL = YES; 467 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 468 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 469 | TARGETED_DEVICE_FAMILY = "1,2"; 470 | VERSIONING_SYSTEM = "apple-generic"; 471 | VERSION_INFO_PREFIX = ""; 472 | }; 473 | name = Debug; 474 | }; 475 | 5C03182EF97D6FF75EAE9622BB792D8B /* Debug */ = { 476 | isa = XCBuildConfiguration; 477 | baseConfigurationReference = F578B84DB921DA1601FE66E8F52D6B5F /* youtube-ios-player-helper-swift.xcconfig */; 478 | buildSettings = { 479 | CODE_SIGN_IDENTITY = "iPhone Developer"; 480 | CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/youtube-ios-player-helper-swift"; 481 | INFOPLIST_FILE = "Target Support Files/youtube-ios-player-helper-swift/ResourceBundle-youtube-ios-player-helper-swift-Info.plist"; 482 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 483 | PRODUCT_NAME = "youtube-ios-player-helper-swift"; 484 | SDKROOT = iphoneos; 485 | SKIP_INSTALL = YES; 486 | TARGETED_DEVICE_FAMILY = "1,2"; 487 | WRAPPER_EXTENSION = bundle; 488 | }; 489 | name = Debug; 490 | }; 491 | 8E32A4588C8A872CB309656B1E8DD997 /* Debug */ = { 492 | isa = XCBuildConfiguration; 493 | baseConfigurationReference = F578B84DB921DA1601FE66E8F52D6B5F /* youtube-ios-player-helper-swift.xcconfig */; 494 | buildSettings = { 495 | CODE_SIGN_IDENTITY = ""; 496 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 497 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 498 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 499 | CURRENT_PROJECT_VERSION = 1; 500 | DEFINES_MODULE = YES; 501 | DYLIB_COMPATIBILITY_VERSION = 1; 502 | DYLIB_CURRENT_VERSION = 1; 503 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 504 | GCC_PREFIX_HEADER = "Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift-prefix.pch"; 505 | INFOPLIST_FILE = "Target Support Files/youtube-ios-player-helper-swift/Info.plist"; 506 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 507 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 508 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 509 | MODULEMAP_FILE = "Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift.modulemap"; 510 | PRODUCT_MODULE_NAME = youtube_ios_player_helper_swift; 511 | PRODUCT_NAME = youtube_ios_player_helper_swift; 512 | SDKROOT = iphoneos; 513 | SKIP_INSTALL = YES; 514 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; 515 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 516 | SWIFT_VERSION = 4.2; 517 | TARGETED_DEVICE_FAMILY = "1,2"; 518 | VERSIONING_SYSTEM = "apple-generic"; 519 | VERSION_INFO_PREFIX = ""; 520 | }; 521 | name = Debug; 522 | }; 523 | BB7876BB37BC8C7A85DEE01A85D22E0E /* Release */ = { 524 | isa = XCBuildConfiguration; 525 | baseConfigurationReference = F578B84DB921DA1601FE66E8F52D6B5F /* youtube-ios-player-helper-swift.xcconfig */; 526 | buildSettings = { 527 | CODE_SIGN_IDENTITY = ""; 528 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 529 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 530 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 531 | CURRENT_PROJECT_VERSION = 1; 532 | DEFINES_MODULE = YES; 533 | DYLIB_COMPATIBILITY_VERSION = 1; 534 | DYLIB_CURRENT_VERSION = 1; 535 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 536 | GCC_PREFIX_HEADER = "Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift-prefix.pch"; 537 | INFOPLIST_FILE = "Target Support Files/youtube-ios-player-helper-swift/Info.plist"; 538 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 539 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 540 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 541 | MODULEMAP_FILE = "Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift.modulemap"; 542 | PRODUCT_MODULE_NAME = youtube_ios_player_helper_swift; 543 | PRODUCT_NAME = youtube_ios_player_helper_swift; 544 | SDKROOT = iphoneos; 545 | SKIP_INSTALL = YES; 546 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; 547 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 548 | SWIFT_VERSION = 4.2; 549 | TARGETED_DEVICE_FAMILY = "1,2"; 550 | VALIDATE_PRODUCT = YES; 551 | VERSIONING_SYSTEM = "apple-generic"; 552 | VERSION_INFO_PREFIX = ""; 553 | }; 554 | name = Release; 555 | }; 556 | C1235C472A55347BD3D75F5A6BEE8F87 /* Release */ = { 557 | isa = XCBuildConfiguration; 558 | baseConfigurationReference = F578B84DB921DA1601FE66E8F52D6B5F /* youtube-ios-player-helper-swift.xcconfig */; 559 | buildSettings = { 560 | CODE_SIGN_IDENTITY = "iPhone Developer"; 561 | CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/youtube-ios-player-helper-swift"; 562 | INFOPLIST_FILE = "Target Support Files/youtube-ios-player-helper-swift/ResourceBundle-youtube-ios-player-helper-swift-Info.plist"; 563 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 564 | PRODUCT_NAME = "youtube-ios-player-helper-swift"; 565 | SDKROOT = iphoneos; 566 | SKIP_INSTALL = YES; 567 | TARGETED_DEVICE_FAMILY = "1,2"; 568 | WRAPPER_EXTENSION = bundle; 569 | }; 570 | name = Release; 571 | }; 572 | E1AFFBEF692E8B9A5AFE94E2B531570C /* Release */ = { 573 | isa = XCBuildConfiguration; 574 | baseConfigurationReference = A79AC23D5A157FED70D9C53D844B2319 /* Pods-Example.release.xcconfig */; 575 | buildSettings = { 576 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; 577 | CODE_SIGN_IDENTITY = ""; 578 | "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; 579 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 580 | "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; 581 | CURRENT_PROJECT_VERSION = 1; 582 | DEFINES_MODULE = YES; 583 | DYLIB_COMPATIBILITY_VERSION = 1; 584 | DYLIB_CURRENT_VERSION = 1; 585 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 586 | INFOPLIST_FILE = "Target Support Files/Pods-Example/Info.plist"; 587 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 588 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 589 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 590 | MACH_O_TYPE = staticlib; 591 | MODULEMAP_FILE = "Target Support Files/Pods-Example/Pods-Example.modulemap"; 592 | OTHER_LDFLAGS = ""; 593 | OTHER_LIBTOOLFLAGS = ""; 594 | PODS_ROOT = "$(SRCROOT)"; 595 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; 596 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 597 | SDKROOT = iphoneos; 598 | SKIP_INSTALL = YES; 599 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 600 | TARGETED_DEVICE_FAMILY = "1,2"; 601 | VALIDATE_PRODUCT = YES; 602 | VERSIONING_SYSTEM = "apple-generic"; 603 | VERSION_INFO_PREFIX = ""; 604 | }; 605 | name = Release; 606 | }; 607 | F4568DEE257655D290C2B9CEAB37C934 /* Release */ = { 608 | isa = XCBuildConfiguration; 609 | buildSettings = { 610 | ALWAYS_SEARCH_USER_PATHS = NO; 611 | CLANG_ANALYZER_NONNULL = YES; 612 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 613 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 614 | CLANG_CXX_LIBRARY = "libc++"; 615 | CLANG_ENABLE_MODULES = YES; 616 | CLANG_ENABLE_OBJC_ARC = YES; 617 | CLANG_ENABLE_OBJC_WEAK = YES; 618 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 619 | CLANG_WARN_BOOL_CONVERSION = YES; 620 | CLANG_WARN_COMMA = YES; 621 | CLANG_WARN_CONSTANT_CONVERSION = YES; 622 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 623 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 624 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 625 | CLANG_WARN_EMPTY_BODY = YES; 626 | CLANG_WARN_ENUM_CONVERSION = YES; 627 | CLANG_WARN_INFINITE_RECURSION = YES; 628 | CLANG_WARN_INT_CONVERSION = YES; 629 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 630 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 631 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 632 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 633 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 634 | CLANG_WARN_STRICT_PROTOTYPES = YES; 635 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 636 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 637 | CLANG_WARN_UNREACHABLE_CODE = YES; 638 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 639 | CODE_SIGNING_ALLOWED = NO; 640 | CODE_SIGNING_REQUIRED = NO; 641 | COPY_PHASE_STRIP = NO; 642 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 643 | ENABLE_NS_ASSERTIONS = NO; 644 | ENABLE_STRICT_OBJC_MSGSEND = YES; 645 | GCC_C_LANGUAGE_STANDARD = gnu11; 646 | GCC_NO_COMMON_BLOCKS = YES; 647 | GCC_PREPROCESSOR_DEFINITIONS = ( 648 | "POD_CONFIGURATION_RELEASE=1", 649 | "$(inherited)", 650 | ); 651 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 652 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 653 | GCC_WARN_UNDECLARED_SELECTOR = YES; 654 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 655 | GCC_WARN_UNUSED_FUNCTION = YES; 656 | GCC_WARN_UNUSED_VARIABLE = YES; 657 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 658 | MTL_ENABLE_DEBUG_INFO = NO; 659 | PRODUCT_NAME = "$(TARGET_NAME)"; 660 | STRIP_INSTALLED_PRODUCT = NO; 661 | SWIFT_COMPILATION_MODE = wholemodule; 662 | SYMROOT = "${SRCROOT}/../build"; 663 | }; 664 | name = Release; 665 | }; 666 | /* End XCBuildConfiguration section */ 667 | 668 | /* Begin XCConfigurationList section */ 669 | 177F292D41CBBB0A04FE205CECE40A44 /* Build configuration list for PBXNativeTarget "youtube-ios-player-helper-swift-youtube-ios-player-helper-swift" */ = { 670 | isa = XCConfigurationList; 671 | buildConfigurations = ( 672 | 5C03182EF97D6FF75EAE9622BB792D8B /* Debug */, 673 | C1235C472A55347BD3D75F5A6BEE8F87 /* Release */, 674 | ); 675 | defaultConfigurationIsVisible = 0; 676 | defaultConfigurationName = Release; 677 | }; 678 | 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { 679 | isa = XCConfigurationList; 680 | buildConfigurations = ( 681 | 1EE19F5DD95931924296F637BF18BD8F /* Debug */, 682 | F4568DEE257655D290C2B9CEAB37C934 /* Release */, 683 | ); 684 | defaultConfigurationIsVisible = 0; 685 | defaultConfigurationName = Release; 686 | }; 687 | DB821E516FEE2C73D88BC12B33250F91 /* Build configuration list for PBXNativeTarget "youtube-ios-player-helper-swift" */ = { 688 | isa = XCConfigurationList; 689 | buildConfigurations = ( 690 | 8E32A4588C8A872CB309656B1E8DD997 /* Debug */, 691 | BB7876BB37BC8C7A85DEE01A85D22E0E /* Release */, 692 | ); 693 | defaultConfigurationIsVisible = 0; 694 | defaultConfigurationName = Release; 695 | }; 696 | EF3576272239D81BEF9169CDCE96634E /* Build configuration list for PBXNativeTarget "Pods-Example" */ = { 697 | isa = XCConfigurationList; 698 | buildConfigurations = ( 699 | 3CFEB464668A0F3350F1C7D0EEB33FF9 /* Debug */, 700 | E1AFFBEF692E8B9A5AFE94E2B531570C /* Release */, 701 | ); 702 | defaultConfigurationIsVisible = 0; 703 | defaultConfigurationName = Release; 704 | }; 705 | /* End XCConfigurationList section */ 706 | }; 707 | rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; 708 | } 709 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/moayadalkouz.xcuserdatad/xcschemes/Pods-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/moayadalkouz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-Example.xcscheme 8 | 9 | isShown 10 | 11 | orderHint 12 | 0 13 | 14 | youtube-ios-player-helper-swift-youtube-ios-player-helper-swift.xcscheme 15 | 16 | isShown 17 | 18 | orderHint 19 | 2 20 | 21 | youtube-ios-player-helper-swift.xcscheme 22 | 23 | isShown 24 | 25 | orderHint 26 | 1 27 | 28 | 29 | SuppressBuildableAutocreation 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/moayadalkouz.xcuserdatad/xcschemes/youtube-ios-player-helper-swift-youtube-ios-player-helper-swift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Example/Pods/Pods.xcodeproj/xcuserdata/moayadalkouz.xcuserdatad/xcschemes/youtube-ios-player-helper-swift.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 66 | 67 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/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 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 7 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # frameworks to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 14 | 15 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 16 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 17 | 18 | # Used as a return value for each invocation of `strip_invalid_archs` function. 19 | STRIP_BINARY_RETVAL=0 20 | 21 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 22 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 23 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 24 | 25 | # Copies and strips a vendored framework 26 | install_framework() 27 | { 28 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 29 | local source="${BUILT_PRODUCTS_DIR}/$1" 30 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 31 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 32 | elif [ -r "$1" ]; then 33 | local source="$1" 34 | fi 35 | 36 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 37 | 38 | if [ -L "${source}" ]; then 39 | echo "Symlinked..." 40 | source="$(readlink "${source}")" 41 | fi 42 | 43 | # Use filter instead of exclude so missing patterns don't throw errors. 44 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 45 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 46 | 47 | local basename 48 | basename="$(basename -s .framework "$1")" 49 | binary="${destination}/${basename}.framework/${basename}" 50 | if ! [ -r "$binary" ]; then 51 | binary="${destination}/${basename}" 52 | fi 53 | 54 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 55 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 56 | strip_invalid_archs "$binary" 57 | fi 58 | 59 | # Resign the code if required by the build settings to avoid unstable apps 60 | code_sign_if_enabled "${destination}/$(basename "$1")" 61 | 62 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 63 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 64 | local swift_runtime_libs 65 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 66 | for lib in $swift_runtime_libs; do 67 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 68 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 69 | code_sign_if_enabled "${destination}/${lib}" 70 | done 71 | fi 72 | } 73 | 74 | # Copies and strips a vendored dSYM 75 | install_dsym() { 76 | local source="$1" 77 | if [ -r "$source" ]; then 78 | # Copy the dSYM into a the targets temp dir. 79 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 80 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 81 | 82 | local basename 83 | basename="$(basename -s .framework.dSYM "$source")" 84 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 85 | 86 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 87 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 88 | strip_invalid_archs "$binary" 89 | fi 90 | 91 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 92 | # Move the stripped file into its final destination. 93 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 94 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 95 | else 96 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 97 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 98 | fi 99 | fi 100 | } 101 | 102 | # Signs a framework with the provided identity 103 | code_sign_if_enabled() { 104 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 105 | # Use the current code_sign_identitiy 106 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 107 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 108 | 109 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 110 | code_sign_cmd="$code_sign_cmd &" 111 | fi 112 | echo "$code_sign_cmd" 113 | eval "$code_sign_cmd" 114 | fi 115 | } 116 | 117 | # Strip invalid architectures 118 | strip_invalid_archs() { 119 | binary="$1" 120 | # Get architectures for current target binary 121 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 122 | # Intersect them with the architectures we are building for 123 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 124 | # If there are no archs supported by this binary then warn the user 125 | if [[ -z "$intersected_archs" ]]; then 126 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 127 | STRIP_BINARY_RETVAL=0 128 | return 129 | fi 130 | stripped="" 131 | for arch in $binary_archs; do 132 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 133 | # Strip non-valid architectures in-place 134 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 135 | stripped="$stripped $arch" 136 | fi 137 | done 138 | if [[ "$stripped" ]]; then 139 | echo "Stripped $binary of architectures:$stripped" 140 | fi 141 | STRIP_BINARY_RETVAL=1 142 | } 143 | 144 | 145 | if [[ "$CONFIGURATION" == "Debug" ]]; then 146 | install_framework "${BUILT_PRODUCTS_DIR}/youtube-ios-player-helper-swift/youtube_ios_player_helper_swift.framework" 147 | fi 148 | if [[ "$CONFIGURATION" == "Release" ]]; then 149 | install_framework "${BUILT_PRODUCTS_DIR}/youtube-ios-player-helper-swift/youtube_ios_player_helper_swift.framework" 150 | fi 151 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 152 | wait 153 | fi 154 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 60 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 61 | ;; 62 | *.xib) 63 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true 64 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 115 | else 116 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double Pods_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/youtube-ios-player-helper-swift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/youtube-ios-player-helper-swift/youtube_ios_player_helper_swift.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "youtube_ios_player_helper_swift" 7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Example { 2 | umbrella header "Pods-Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/youtube-ios-player-helper-swift" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/youtube-ios-player-helper-swift/youtube_ios_player_helper_swift.framework/Headers" 6 | OTHER_LDFLAGS = $(inherited) -framework "youtube_ios_player_helper_swift" 7 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 8 | PODS_BUILD_DIR = ${BUILD_DIR} 9 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 10 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 11 | PODS_ROOT = ${SRCROOT}/Pods 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/youtube-ios-player-helper-swift/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 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/youtube-ios-player-helper-swift/ResourceBundle-youtube-ios-player-helper-swift-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleIdentifier 8 | ${PRODUCT_BUNDLE_IDENTIFIER} 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | ${PRODUCT_NAME} 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_youtube_ios_player_helper_swift : NSObject 3 | @end 4 | @implementation PodsDummy_youtube_ios_player_helper_swift 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift-umbrella.h: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | 14 | FOUNDATION_EXPORT double youtube_ios_player_helper_swiftVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char youtube_ios_player_helper_swiftVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift.modulemap: -------------------------------------------------------------------------------- 1 | framework module youtube_ios_player_helper_swift { 2 | umbrella header "youtube-ios-player-helper-swift-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/youtube-ios-player-helper-swift/youtube-ios-player-helper-swift.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/youtube-ios-player-helper-swift 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # youtube-ios-player-helper-swift 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/youtube-ios-player-helper-swift.svg?style=flat)](http://cocoapods.org/pods/youtube-ios-player-helper-swift) 4 | [![License](https://img.shields.io/cocoapods/l/youtube-ios-player-helper-swift.svg?style=flat)](http://cocoapods.org/pods/youtube-ios-player-helper-swift) 5 | [![Platform](https://img.shields.io/cocoapods/p/youtube-ios-player-helper-swift.svg?style=flat)](http://cocoapods.org/pods/youtube-ios-player-helper-swift) 6 | 7 | 8 |

Helper library for iOS developers looking to add YouTube video playback in their applications via the iframe player in a UIWebView

9 | 10 |

This library is the same of old objective-c https://github.com/youtube/youtube-ios-player-helper

11 | 12 | 13 | 14 | ## Features 15 | 16 | * Interface builder designable 17 | * Highly customizable and flexible 18 | * Easy to use 19 | * Written in Swift 20 | 21 | ## Installation 22 | 23 | ### CocoaPods 24 | 25 | 1. Install [CocoaPods](https://cocoapods.org) 26 | 2. Add this repo to your `Podfile` 27 | 28 | ```ruby 29 | target 'Example' do 30 | # IMPORTANT: Make sure use_frameworks! is included at the top of the file 31 | use_frameworks! 32 | platform :ios, '8.0' 33 | pod 'youtube-ios-player-helper-swift' 34 | end 35 | ``` 36 | 3. Run `pod install` 37 | 4. Open up the `.xcworkspace` that CocoaPods created 38 | 5. Done! 39 | 40 | ## Usage 41 | 42 | 43 | ## Example project 44 | 45 | Take a look at the example project over [here](Example/) 46 | 47 | 1. Download it 48 | 2. Open the `Example.xcworkspace` in Xcode 49 | 3. Enjoy! 50 | 51 | 52 | 53 | ## Author 54 | 55 | Moayad Al kouz, moayad_kouz9@hotmail.com 56 |

57 | Twitter : @malkouz 58 | 59 | ## License 60 | 61 | youtube-ios-player-helper-swift is available under the Apache License. See the LICENSE file for more info. 62 | 63 | -------------------------------------------------------------------------------- /youtube-ios-player-helper-swift.podspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pod::Spec.new do |s| 4 | s.name = 'youtube-ios-player-helper-swift' 5 | s.version = '1.1' 6 | s.summary = 'Helper library for iOS developers looking to add YouTube video playback in their applications via the iframe player in a UIWebView.' 7 | s.swift_version = '4.2' 8 | s.description = <<-DESC 9 | A full swift implementation of https://github.com/youtube/youtube-ios-player-helper. Helper library for iOS developers looking to add YouTube video playback in their applications via the iframe player in a UIWebView. 10 | DESC 11 | 12 | s.homepage = 'https://github.com/malkouz/youtube-ios-player-helper-swift' 13 | s.license = { :type => 'Apache License 2.0', :file => 'LICENSE' } 14 | s.author = { 'Moayad Al kouz' => 'moayad_kouz9@hotmail.com' } 15 | s.source = { :git => 'https://github.com/malkouz/youtube-ios-player-helper-swift.git', :tag => s.version.to_s } 16 | # s.social_media_url = 'https://twitter.com/malkouz' 17 | 18 | s.ios.deployment_target = '8.0' 19 | 20 | s.source_files = 'youtube-ios-player-helper-swift/Classes/**/*' 21 | 22 | s.resource_bundles = { 23 | 'youtube-ios-player-helper-swift' => ['youtube-ios-player-helper-swift/Assets/*'] 24 | } 25 | 26 | 27 | end 28 | -------------------------------------------------------------------------------- /youtube-ios-player-helper-swift/Assets/YTPlayerView-iframe-player.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 33 | 34 | 35 |
36 |
37 |
38 | 39 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /youtube-ios-player-helper-swift/Assets/YTPlayerView-iframe-playerIPAD.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 33 | 34 | 35 |
36 |
37 |
38 | 39 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /youtube-ios-player-helper-swift/Classes/YTPlayerView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // YTPlayerView.swift 3 | // YouTubePlayer-Swift 4 | // 5 | // Created by Moayad Al kouz on 7/22/18. 6 | // Copyright © 2018 Moayad Al kouz. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | /** These enums represent the state of the current video in the player. */ 12 | public enum YTPlayerState: String{ 13 | case unstarted = "-1" 14 | case ended = "0" 15 | case playing = "1" 16 | case paused = "2" 17 | case buffering = "3" 18 | case queued = "5" 19 | case unknown = "unknown" 20 | } 21 | 22 | /** These enums represent the resolution of the currently loaded video. */ 23 | public enum YTPlaybackQuality: String { 24 | case small = "small" 25 | case medium = "medium" 26 | case large = "large" 27 | case hd720 = "hd720" 28 | case hd1080 = "hd1080" 29 | case highRes = "highres" 30 | case auto = "auto" /** Addition for YouTube Live Events. */ 31 | case defaults = "default" 32 | case unknown = "unknown" /** This should never be returned. It is here for future proofing. */ 33 | } 34 | 35 | /** These enums represent error codes thrown by the player. */ 36 | public enum YTPlayerError: String{ 37 | case invalidParam = "2" 38 | case html5Error = "5" 39 | case videoNotFound = "100" // Functionally equivalent error codes 100 and 40 | // 105 have been collapsed into |kYTPlayerErrorVideoNotFound|. 41 | case notEmbeddable = "101" // Functionally equivalent error codes 101 and 42 | // 150 have been collapsed into |kYTPlayerErrorNotEmbeddable|. 43 | case cannotFindVideo = "105" 44 | case sameAsNotEmbeddable = "150" 45 | case unknown 46 | } 47 | 48 | public enum YTPlayerCallback: String{ 49 | case onReady = "onReady" 50 | case onStateChange = "onStateChange" 51 | case onPlaybackQualityChange = "onPlaybackQualityChange" 52 | case onError = "onError" 53 | case onPlayTime = "onPlayTime" 54 | 55 | case onYouTubeIframeAPIReady = "onYouTubeIframeAPIReady" 56 | case onYouTubeIframeAPIFailedToLoad = "onYouTubeIframeAPIFailedToLoad" 57 | } 58 | 59 | public enum YTRegexPatterns: String{ 60 | case embedUrl = "^http(s)://(www.)youtube.com/embed/(.*)$" 61 | case adUrl = "^http(s)://pubads.g.doubleclick.net/pagead/conversion/" 62 | case oAuth = "^http(s)://accounts.google.com/o/oauth2/(.*)$" 63 | case staticProxy = "^https://content.googleapis.com/static/proxy.html(.*)$" 64 | case syndication = "^https://tpc.googlesyndication.com/sodar/(.*).html$" 65 | } 66 | 67 | public protocol YTPlayerViewDelegate { 68 | func playerViewDidBecomeReady(_ playerView: YTPlayerView) 69 | func playerView(_ playerView: YTPlayerView, didChangeTo state: YTPlayerState) 70 | func playerView(_ playerView: YTPlayerView, didChangeTo quality: YTPlaybackQuality) 71 | func playerView(_ playerView: YTPlayerView, receivedError error: YTPlayerError) 72 | func playerView(_ playerView: YTPlayerView, didPlayTime playTime: Float) 73 | func playerViewPreferredWebViewBackgroundColor(_ playerView: YTPlayerView) -> UIColor 74 | func playerViewPreferredInitialLoadingView(_ playerView: YTPlayerView) -> UIView? 75 | } 76 | 77 | public extension YTPlayerViewDelegate{ 78 | func playerViewDidBecomeReady(_ playerView: YTPlayerView){ 79 | } 80 | 81 | func playerView(_ playerView: YTPlayerView, didChangeTo state: YTPlayerState){ 82 | } 83 | 84 | func playerView(_ playerView: YTPlayerView, didChangeTo quality: YTPlaybackQuality){ 85 | } 86 | 87 | func playerView(_ playerView: YTPlayerView, receivedError error: YTPlayerError) { 88 | } 89 | 90 | func playerView(_ playerView: YTPlayerView, didPlayTime playTime: Float){ 91 | } 92 | 93 | func playerViewPreferredWebViewBackgroundColor(_ playerView: YTPlayerView) -> UIColor{ 94 | return UIColor.black 95 | } 96 | 97 | func playerViewPreferredInitialLoadingView(_ playerView: YTPlayerView) -> UIView?{ 98 | return nil 99 | } 100 | } 101 | 102 | 103 | open class YTPlayerView: UIView { 104 | var webView: UIWebView! 105 | open var delegate: YTPlayerViewDelegate? 106 | 107 | var originURL: URL! 108 | var initialLoadingView: UIView? 109 | 110 | // /** 111 | // * This method loads the player with the given video ID. 112 | // * This is a convenience method for calling YTPlayerView::loadPlayerWithVideoId:withPlayerVars: 113 | // * without player variables. 114 | // * 115 | // * This method reloads the entire contents of the UIWebView and regenerates its HTML contents. 116 | // * To change the currently loaded video without reloading the entire UIWebView, use the 117 | // * YTPlayerView::cueVideoById:startSeconds:suggestedQuality: family of methods. 118 | // * 119 | // * @param videoId The YouTube video ID of the video to load in the player view. 120 | // * @return YES if player has been configured correctly, NO otherwise. 121 | // */ 122 | // public func load(videoId: String) -> Bool{ 123 | // return self.loadWithVideo(id: id, playerVars: nil) 124 | // } 125 | // 126 | // /** 127 | // * This method loads the player with the given playlist ID. 128 | // * This is a convenience method for calling YTPlayerView::loadWithPlaylistId:withPlayerVars: 129 | // * without player variables. 130 | // * 131 | // * This method reloads the entire contents of the UIWebView and regenerates its HTML contents. 132 | // * To change the currently loaded video without reloading the entire UIWebView, use the 133 | // * YTPlayerView::cuePlaylistByPlaylistId:index:startSeconds:suggestedQuality: 134 | // * family of methods. 135 | // * 136 | // * @param playlistId The YouTube playlist ID of the playlist to load in the player view. 137 | // * @return YES if player has been configured correctly, NO otherwise. 138 | // */ 139 | // public func load(playlistId: String) -> Bool{ 140 | // return self.loadWithPlaylist(playlistId: playlistId, playerVars: nil) 141 | // } 142 | 143 | /** 144 | * This method loads the player with the given video ID and player variables. Player variables 145 | * specify optional parameters for video playback. For instance, to play a YouTube 146 | * video inline, the following playerVars dictionary would be used: 147 | * 148 | * @code 149 | * @{ @"playsinline" : @1 }; 150 | * @endcode 151 | * 152 | * Note that when the documentation specifies a valid value as a number (typically 0, 1 or 2), 153 | * both strings and integers are valid values. The full list of parameters is defined at: 154 | * https://developers.google.com/youtube/player_parameters?playerVersion=HTML5. 155 | * 156 | * This method reloads the entire contents of the UIWebView and regenerates its HTML contents. 157 | * To change the currently loaded video without reloading the entire UIWebView, use the 158 | * YTPlayerView::cueVideoById:startSeconds:suggestedQuality: family of methods. 159 | * 160 | * @param videoId The YouTube video ID of the video to load in the player view. 161 | * @param playerVars An NSDictionary of player parameters. 162 | * @return YES if player has been configured correctly, NO otherwise. 163 | */ 164 | public func load(videoId: String, playerVars:[String: Any]? = nil) -> Bool{ 165 | var newPlayerVars = [String : Any]() 166 | if let vars = playerVars { 167 | newPlayerVars = vars 168 | } 169 | let playerParams: [String : Any] = [ "videoId" : videoId, "playerVars": newPlayerVars ] 170 | return self.loadWithPlayerParams(additionalPlayerParams: playerParams) 171 | 172 | } 173 | 174 | /** 175 | * This method loads the player with the given playlist ID and player variables. Player variables 176 | * specify optional parameters for video playback. For instance, to play a YouTube 177 | * video inline, the following playerVars dictionary would be used: 178 | * 179 | * @code 180 | * @{ @"playsinline" : @1 }; 181 | * @endcode 182 | * 183 | * Note that when the documentation specifies a valid value as a number (typically 0, 1 or 2), 184 | * both strings and integers are valid values. The full list of parameters is defined at: 185 | * https://developers.google.com/youtube/player_parameters?playerVersion=HTML5. 186 | * 187 | * This method reloads the entire contents of the UIWebView and regenerates its HTML contents. 188 | * To change the currently loaded video without reloading the entire UIWebView, use the 189 | * YTPlayerView::cuePlaylistByPlaylistId:index:startSeconds:suggestedQuality: 190 | * family of methods. 191 | * 192 | * @param playlistId The YouTube playlist ID of the playlist to load in the player view. 193 | * @param playerVars An NSDictionary of player parameters. 194 | * @return YES if player has been configured correctly, NO otherwise. 195 | */ 196 | 197 | 198 | public func load(playlistId: String, playerVars:[String: Any]? = nil) -> Bool{ 199 | var newPlayerVars = [String : Any]() 200 | newPlayerVars["listType"] = "playlist" 201 | newPlayerVars["list"] = playlistId 202 | if let vars = playerVars { 203 | for (key,value) in vars { 204 | newPlayerVars.updateValue(value, forKey:key) 205 | } 206 | } 207 | 208 | let playerParams: [String : Any] = [ "playerVars": newPlayerVars ] 209 | return self.loadWithPlayerParams(additionalPlayerParams: playerParams) 210 | } 211 | 212 | //MARK:- Player controls 213 | 214 | // These methods correspond to their JavaScript equivalents as documented here: 215 | // https://developers.google.com/youtube/iframe_api_reference#Playback_controls 216 | 217 | /** 218 | * Starts or resumes playback on the loaded video. Corresponds to this method from 219 | * the JavaScript API: 220 | * https://developers.google.com/youtube/iframe_api_reference#playVideo 221 | */ 222 | public func playVideo(){ 223 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: "player.playVideo();") 224 | } 225 | 226 | /** 227 | * Pauses playback on a playing video. Corresponds to this method from 228 | * the JavaScript API: 229 | * https://developers.google.com/youtube/iframe_api_reference#pauseVideo 230 | */ 231 | public func pauseVideo(){ 232 | if let url = URL(string: String(format: "ytplayer://onStateChange?data=%@", YTPlayerState.paused.rawValue)){ 233 | self.notifyDelegateOfYouTubeCallbackUrl(url: url) 234 | } 235 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: "player.pauseVideo();") 236 | } 237 | 238 | /** 239 | * Stops playback on a playing video. Corresponds to this method from 240 | * the JavaScript API: 241 | * https://developers.google.com/youtube/iframe_api_reference#stopVideo 242 | */ 243 | public func stopVideo(){ 244 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: "player.stopVideo();") 245 | } 246 | 247 | /** 248 | * Seek to a given time on a playing video. Corresponds to this method from 249 | * the JavaScript API: 250 | * https://developers.google.com/youtube/iframe_api_reference#seekTo 251 | * 252 | * @param seekToSeconds The time in seconds to seek to in the loaded video. 253 | * @param allowSeekAhead Whether to make a new request to the server if the time is 254 | * outside what is currently buffered. Recommended to set to YES. 255 | */ 256 | public func seek(seekToSeconds: Float, allowSeekAhead: Bool){ 257 | let secondsValue = NSNumber(value: seekToSeconds).stringValue 258 | let allowSeekAheadValue = self.stringForJSBoolean(boolValue: allowSeekAhead) 259 | let command = String(format: "player.seekTo(%@, %@);", secondsValue, allowSeekAheadValue) 260 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 261 | } 262 | 263 | //MARK:- Queuing videos 264 | 265 | // Queueing functions for videos. These methods correspond to their JavaScript 266 | // equivalents as documented here: 267 | // https://developers.google.com/youtube/iframe_api_reference#Queueing_Functions 268 | 269 | /** 270 | * Cues a given video by its video ID for playback starting at the given time and with the 271 | * suggested quality. Cueing loads a video, but does not start video playback. This method 272 | * corresponds with its JavaScript API equivalent as documented here: 273 | * https://developers.google.com/youtube/iframe_api_reference#cueVideoById 274 | * 275 | * @param videoId A video ID to cue. 276 | * @param startSeconds Time in seconds to start the video when YTPlayerView::playVideo is called. 277 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 278 | */ 279 | public func cue(videoId: String, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 280 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 281 | let qualityValue = suggestedQuality.rawValue 282 | let command = String(format: "player.cueVideoById('%@', %@, '%@');", videoId, startSecondsValue, qualityValue) 283 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 284 | } 285 | 286 | /** 287 | * Cues a given video by its video ID for playback starting and ending at the given times 288 | * with the suggested quality. Cueing loads a video, but does not start video playback. This 289 | * method corresponds with its JavaScript API equivalent as documented here: 290 | * https://developers.google.com/youtube/iframe_api_reference#cueVideoById 291 | * 292 | * @param videoId A video ID to cue. 293 | * @param startSeconds Time in seconds to start the video when playVideo() is called. 294 | * @param endSeconds Time in seconds to end the video after it begins playing. 295 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 296 | */ 297 | public func cue(videoId: String, startSeconds: Float, endSeconds: Float, suggestedQuality: YTPlaybackQuality){ 298 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 299 | let endSecondsValue = NSNumber(value: endSeconds).stringValue 300 | let qualityValue = suggestedQuality.rawValue 301 | let command = String(format: "player.cueVideoById({'videoId': '%@', 'startSeconds': %@, 'endSeconds': %@, 'suggestedQuality': '%@'});", videoId, startSecondsValue, endSecondsValue, qualityValue) 302 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 303 | } 304 | 305 | /** 306 | * Loads a given video by its video ID for playback starting at the given time and with the 307 | * suggested quality. Loading a video both loads it and begins playback. This method 308 | * corresponds with its JavaScript API equivalent as documented here: 309 | * https://developers.google.com/youtube/iframe_api_reference#loadVideoById 310 | * 311 | * @param videoId A video ID to load and begin playing. 312 | * @param startSeconds Time in seconds to start the video when it has loaded. 313 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 314 | */ 315 | public func load(videoId: String, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 316 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 317 | let qualityValue = suggestedQuality.rawValue 318 | let command = String(format: "player.loadVideoById('%@', %@, '%@');", videoId, startSecondsValue, qualityValue) 319 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 320 | } 321 | 322 | /** 323 | * Loads a given video by its video ID for playback starting and ending at the given times 324 | * with the suggested quality. Loading a video both loads it and begins playback. This method 325 | * corresponds with its JavaScript API equivalent as documented here: 326 | * https://developers.google.com/youtube/iframe_api_reference#loadVideoById 327 | * 328 | * @param videoId A video ID to load and begin playing. 329 | * @param startSeconds Time in seconds to start the video when it has loaded. 330 | * @param endSeconds Time in seconds to end the video after it begins playing. 331 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 332 | */ 333 | public func load(videoId: String, startSeconds: Float, endSeconds: Float, suggestedQuality: YTPlaybackQuality){ 334 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 335 | let endSecondsValue = NSNumber(value: endSeconds).stringValue 336 | let qualityValue = suggestedQuality.rawValue 337 | let command = String(format: "player.loadVideoById({'videoId': '%@', 'startSeconds': %@, 'endSeconds': %@, 'suggestedQuality': '%@'});", videoId, startSecondsValue, endSecondsValue, qualityValue) 338 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 339 | } 340 | 341 | /** 342 | * Cues a given video by its URL on YouTube.com for playback starting at the given time 343 | * and with the suggested quality. Cueing loads a video, but does not start video playback. 344 | * This method corresponds with its JavaScript API equivalent as documented here: 345 | * https://developers.google.com/youtube/iframe_api_reference#cueVideoByUrl 346 | * 347 | * @param videoURL URL of a YouTube video to cue for playback. 348 | * @param startSeconds Time in seconds to start the video when YTPlayerView::playVideo is called. 349 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 350 | */ 351 | public func cue(videoUrl: String, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 352 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 353 | let qualityValue = suggestedQuality.rawValue 354 | let command = String(format: "player.cueVideoByUrl('%@', %@, '%@');", videoUrl, startSecondsValue, qualityValue) 355 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 356 | } 357 | 358 | /** 359 | * Cues a given video by its URL on YouTube.com for playback starting at the given time 360 | * and with the suggested quality. Cueing loads a video, but does not start video playback. 361 | * This method corresponds with its JavaScript API equivalent as documented here: 362 | * https://developers.google.com/youtube/iframe_api_reference#cueVideoByUrl 363 | * 364 | * @param videoURL URL of a YouTube video to cue for playback. 365 | * @param startSeconds Time in seconds to start the video when YTPlayerView::playVideo is called. 366 | * @param endSeconds Time in seconds to end the video after it begins playing. 367 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 368 | */ 369 | public func cue(videoUrl: String, startSeconds: Float, endSeconds: Float, suggestedQuality: YTPlaybackQuality){ 370 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 371 | let endSecondsValue = NSNumber(value: endSeconds).stringValue 372 | let qualityValue = suggestedQuality.rawValue 373 | let command = String(format: "player.cueVideoByUrl('%@', %@, %@, '%@');", videoUrl, startSecondsValue, endSecondsValue, qualityValue) 374 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 375 | } 376 | 377 | /** 378 | * Loads a given video by its video ID for playback starting at the given time 379 | * with the suggested quality. Loading a video both loads it and begins playback. This method 380 | * corresponds with its JavaScript API equivalent as documented here: 381 | * https://developers.google.com/youtube/iframe_api_reference#loadVideoByUrl 382 | * 383 | * @param videoURL URL of a YouTube video to load and play. 384 | * @param startSeconds Time in seconds to start the video when it has loaded. 385 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 386 | */ 387 | public func load(videoUrl: String, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 388 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 389 | let qualityValue = suggestedQuality.rawValue 390 | let command = String(format: "player.loadVideoByUrl('%@', %@, '%@');", videoUrl, startSecondsValue, qualityValue) 391 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 392 | } 393 | 394 | /** 395 | * Loads a given video by its video ID for playback starting and ending at the given times 396 | * with the suggested quality. Loading a video both loads it and begins playback. This method 397 | * corresponds with its JavaScript API equivalent as documented here: 398 | * https://developers.google.com/youtube/iframe_api_reference#loadVideoByUrl 399 | * 400 | * @param videoURL URL of a YouTube video to load and play. 401 | * @param startSeconds Time in seconds to start the video when it has loaded. 402 | * @param endSeconds Time in seconds to end the video after it begins playing. 403 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 404 | */ 405 | public func load(videoUrl: String, startSeconds: Float, endSeconds: Float, suggestedQuality: YTPlaybackQuality){ 406 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 407 | let endSecondsValue = NSNumber(value: endSeconds).stringValue 408 | let qualityValue = suggestedQuality.rawValue 409 | let command = String(format: "player.loadVideoByUrl('%@', %@, %@, '%@');", videoUrl, startSecondsValue, endSecondsValue, qualityValue) 410 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 411 | } 412 | 413 | //MARK:- Queuing functions for playlists 414 | 415 | // Queueing functions for playlists. These methods correspond to 416 | // the JavaScript methods defined here: 417 | // https://developers.google.com/youtube/js_api_reference#Playlist_Queueing_Functions 418 | 419 | /** 420 | * Cues a given playlist with the given ID. The |index| parameter specifies the 0-indexed 421 | * position of the first video to play, starting at the given time and with the 422 | * suggested quality. Cueing loads a playlist, but does not start video playback. This method 423 | * corresponds with its JavaScript API equivalent as documented here: 424 | * https://developers.google.com/youtube/iframe_api_reference#cuePlaylist 425 | * 426 | * @param playlistId Playlist ID of a YouTube playlist to cue. 427 | * @param index A 0-indexed position specifying the first video to play. 428 | * @param startSeconds Time in seconds to start the video when YTPlayerView::playVideo is called. 429 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 430 | */ 431 | public func cue(playlistId: String, index: Int, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 432 | let playlistIdString = String(format: "'%@'", playlistId) 433 | self.cuePlaylist(cueingString: playlistIdString, index: index, startSeconds: startSeconds, suggestedQuality: suggestedQuality) 434 | } 435 | 436 | 437 | /** 438 | * Cues a playlist of videos with the given video IDs. The |index| parameter specifies the 439 | * 0-indexed position of the first video to play, starting at the given time and with the 440 | * suggested quality. Cueing loads a playlist, but does not start video playback. This method 441 | * corresponds with its JavaScript API equivalent as documented here: 442 | * https://developers.google.com/youtube/iframe_api_reference#cuePlaylist 443 | * 444 | * @param videoIds An NSArray of video IDs to compose the playlist of. 445 | * @param index A 0-indexed position specifying the first video to play. 446 | * @param startSeconds Time in seconds to start the video when YTPlayerView::playVideo is called. 447 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 448 | */ 449 | public func cue(videoIds: [String], index: Int, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 450 | self.cuePlaylist(cueingString: self.stringFromVideoIdArray(videoIds: videoIds), index: index, startSeconds: startSeconds, suggestedQuality: suggestedQuality) 451 | } 452 | 453 | /** 454 | * Loads a given playlist with the given ID. The |index| parameter specifies the 0-indexed 455 | * position of the first video to play, starting at the given time and with the 456 | * suggested quality. Loading a playlist starts video playback. This method 457 | * corresponds with its JavaScript API equivalent as documented here: 458 | * https://developers.google.com/youtube/iframe_api_reference#loadPlaylist 459 | * 460 | * @param playlistId Playlist ID of a YouTube playlist to cue. 461 | * @param index A 0-indexed position specifying the first video to play. 462 | * @param startSeconds Time in seconds to start the video when YTPlayerView::playVideo is called. 463 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 464 | */ 465 | public func load(playlistId: String, index: Int, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 466 | let playlistIdString = String(format: "'%@'", playlistId) 467 | self.loadPlaylist(cueingString: playlistIdString, index: index, startSeconds: startSeconds, suggestedQuality: suggestedQuality) 468 | } 469 | 470 | /** 471 | * Loads a playlist of videos with the given video IDs. The |index| parameter specifies the 472 | * 0-indexed position of the first video to play, starting at the given time and with the 473 | * suggested quality. Loading a playlist starts video playback. This method 474 | * corresponds with its JavaScript API equivalent as documented here: 475 | * https://developers.google.com/youtube/iframe_api_reference#loadPlaylist 476 | * 477 | * @param videoIds An NSArray of video IDs to compose the playlist of. 478 | * @param index A 0-indexed position specifying the first video to play. 479 | * @param startSeconds Time in seconds to start the video when YTPlayerView::playVideo is called. 480 | * @param suggestedQuality YTPlaybackQuality value suggesting a playback quality. 481 | */ 482 | public func load(videoIds: [String], index: Int, startSeconds: Float, suggestedQuality: YTPlaybackQuality){ 483 | self.loadPlaylist(cueingString: self.stringFromVideoIdArray(videoIds: videoIds), index: index, startSeconds: startSeconds, suggestedQuality: suggestedQuality) 484 | } 485 | 486 | //MARK:- Playing a video in a playlist 487 | 488 | // These methods correspond to the JavaScript API as defined under the 489 | // "Playing a video in a playlist" section here: 490 | // https://developers.google.com/youtube/iframe_api_reference#Playback_status 491 | 492 | /** 493 | * Loads and plays the next video in the playlist. Corresponds to this method from 494 | * the JavaScript API: 495 | * https://developers.google.com/youtube/iframe_api_reference#nextVideo 496 | */ 497 | public func nextVideo(){ 498 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: "player.nextVideo();") 499 | } 500 | 501 | /** 502 | * Loads and plays the previous video in the playlist. Corresponds to this method from 503 | * the JavaScript API: 504 | * https://developers.google.com/youtube/iframe_api_reference#previousVideo 505 | */ 506 | public func previousVideo(){ 507 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: "player.previousVideo();") 508 | } 509 | 510 | /** 511 | * Loads and plays the video at the given 0-indexed position in the playlist. 512 | * Corresponds to this method from the JavaScript API: 513 | * https://developers.google.com/youtube/iframe_api_reference#playVideoAt 514 | * 515 | * @param index The 0-indexed position of the video in the playlist to load and play. 516 | */ 517 | public func playVideo(at index: Int){ 518 | let command = String(format: "player.playVideoAt(%@);", NSNumber(integerLiteral: index)) 519 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 520 | } 521 | 522 | //MARK:- Setting the playback rate 523 | /** 524 | * Sets/Gets the playback rate. The default value is 1.0, which represents a video 525 | * playing at normal speed. Other values may include 0.25 or 0.5 for slower 526 | * speeds, and 1.5 or 2.0 for faster speeds. To fetch a list of valid values for 527 | * this method, call YTPlayerView::getAvailablePlaybackRates. This method does not 528 | * guarantee that the playback rate will change. 529 | * This method corresponds to the JavaScript API defined here: 530 | * https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate 531 | * 532 | * @param suggestedRate A playback rate to suggest for the player. 533 | */ 534 | public var playbackRate: Float{ 535 | set{ 536 | let command = String(format: "player.setPlaybackRate(%f);", playbackRate) 537 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 538 | } 539 | get{ 540 | if let result = Float(self.stringFromEvaluatingJavaScript(jsToExecute: "player.getPlaybackRate();")){ 541 | return result 542 | } 543 | return 0 544 | } 545 | } 546 | 547 | 548 | /** 549 | * Gets a list of the valid playback rates, useful in conjunction with 550 | * YTPlayerView::setPlaybackRate. This method corresponds to the 551 | * JavaScript API defined here: 552 | * https://developers.google.com/youtube/iframe_api_reference#getPlaybackRate 553 | * 554 | * @return An NSArray containing available playback rates. nil if there is an error. 555 | */ 556 | public func availablePlaybackRates() -> [Float]?{ 557 | let returnValue = self.stringFromEvaluatingJavaScript(jsToExecute: "player.getAvailablePlaybackRates();") 558 | 559 | do { 560 | guard let playbackRateData = returnValue.data(using: .utf8) else{ 561 | return nil 562 | } 563 | 564 | let playbackRates = try JSONSerialization.jsonObject(with: playbackRateData, options: []) 565 | 566 | return playbackRates as? [Float] 567 | } catch { 568 | return nil 569 | } 570 | } 571 | 572 | //MARK:- Setting playback behavior for playlists 573 | 574 | /** 575 | * Sets whether the player should loop back to the first video in the playlist 576 | * after it has finished playing the last video. This method corresponds to the 577 | * JavaScript API defined here: 578 | * https://developers.google.com/youtube/iframe_api_reference#loopPlaylist 579 | * 580 | * @param loop A boolean representing whether the player should loop. 581 | */ 582 | public func set(loop: Bool){ 583 | let loopPlayListValue = self.stringForJSBoolean(boolValue: loop) 584 | let command = String(format: "player.setLoop(%@);", loopPlayListValue) 585 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 586 | } 587 | 588 | /** 589 | * Sets whether the player should shuffle through the playlist. This method 590 | * corresponds to the JavaScript API defined here: 591 | * https://developers.google.com/youtube/iframe_api_reference#shufflePlaylist 592 | * 593 | * @param shuffle A boolean representing whether the player should 594 | * shuffle through the playlist. 595 | */ 596 | public func set(shuffle: Bool){ 597 | let shuffleValue = self.stringForJSBoolean(boolValue: shuffle) 598 | let command = String(format: "player.setShuffle(%@);", shuffleValue) 599 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 600 | } 601 | 602 | //MARK:- Playback status 603 | // These methods correspond to the JavaScript methods defined here: 604 | // https://developers.google.com/youtube/js_api_reference#Playback_status 605 | 606 | /** 607 | * Returns a number between 0 and 1 that specifies the percentage of the video 608 | * that the player shows as buffered. This method corresponds to the 609 | * JavaScript API defined here: 610 | * https://developers.google.com/youtube/iframe_api_reference#getVideoLoadedFraction 611 | * 612 | * @return A float value between 0 and 1 representing the percentage of the video 613 | * already loaded. 614 | */ 615 | public func videoLoadedFraction() -> Float{ 616 | guard let result = Float(self.stringFromEvaluatingJavaScript(jsToExecute: "player.getVideoLoadedFraction();")) else { 617 | return 0 618 | } 619 | return result 620 | } 621 | 622 | /** 623 | * Returns the state of the player. This method corresponds to the 624 | * JavaScript API defined here: 625 | * https://developers.google.com/youtube/iframe_api_reference#getPlayerState 626 | * 627 | * @return |YTPlayerState| representing the state of the player. 628 | */ 629 | public var playerState: YTPlayerState{ 630 | guard let state = YTPlayerState(rawValue: self.stringFromEvaluatingJavaScript(jsToExecute: "player.getPlayerState();")) else{ 631 | return .unknown 632 | } 633 | return state 634 | } 635 | 636 | 637 | /** 638 | * Returns the elapsed time in seconds since the video started playing. This 639 | * method corresponds to the JavaScript API defined here: 640 | * https://developers.google.com/youtube/iframe_api_reference#getCurrentTime 641 | * 642 | * @return Time in seconds since the video started playing. 643 | */ 644 | public var currentTime: Float{ 645 | guard let result = Float(self.stringFromEvaluatingJavaScript(jsToExecute: "player.getCurrentTime();")) else { 646 | return 0 647 | } 648 | return result 649 | } 650 | 651 | 652 | //MARK:- Playback quality 653 | 654 | // Playback quality. These methods correspond to the JavaScript 655 | // methods defined here: 656 | // https://developers.google.com/youtube/js_api_reference#Playback_quality 657 | 658 | /** 659 | * Set and Returns the playback quality. This method corresponds to the 660 | * JavaScript API defined here: 661 | * https://developers.google.com/youtube/iframe_api_reference#getPlaybackQuality 662 | * 663 | * @return YTPlaybackQuality representing the current playback quality. 664 | */ 665 | public var playbackQuality: YTPlaybackQuality{ 666 | get{ 667 | guard let quality = YTPlaybackQuality(rawValue: self.stringFromEvaluatingJavaScript(jsToExecute: "player.getPlaybackQuality();")) else{ 668 | return .unknown 669 | } 670 | return quality 671 | } 672 | set{ 673 | let command = String(format: "player.setPlaybackQuality('%@');", playbackQuality.rawValue) 674 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 675 | } 676 | } 677 | 678 | 679 | /** 680 | * Gets a list of the valid playback quality values, useful in conjunction with 681 | * YTPlayerView::setPlaybackQuality. This method corresponds to the 682 | * JavaScript API defined here: 683 | * https://developers.google.com/youtube/iframe_api_reference#getAvailableQualityLevels 684 | * 685 | * @return An NSArray containing available playback quality levels. Returns nil if there is an error. 686 | */ 687 | public func availableQualityLevels() -> [YTPlaybackQuality]?{ 688 | let value = self.stringFromEvaluatingJavaScript(jsToExecute: "player.getAvailableQualityLevels().toString();") 689 | if value.isEmpty{ 690 | return nil 691 | } 692 | var levels = [YTPlaybackQuality]() 693 | let rawQualityValues = value.components(separatedBy: ",") 694 | for rawQuality in rawQualityValues{ 695 | if let quality = YTPlaybackQuality(rawValue: rawQuality){ 696 | levels.append(quality) 697 | } 698 | } 699 | 700 | if levels.count > 0{ 701 | return levels 702 | }else{ 703 | return nil 704 | } 705 | } 706 | 707 | //MARK:- Retrieving video information 708 | 709 | // Retrieving video information. These methods correspond to the JavaScript 710 | // methods defined here: 711 | // https://developers.google.com/youtube/js_api_reference#Retrieving_video_information 712 | 713 | /** 714 | * Returns the duration in seconds since the video of the video. This 715 | * method corresponds to the JavaScript API defined here: 716 | * https://developers.google.com/youtube/iframe_api_reference#getDuration 717 | * 718 | * @return Length of the video in seconds. 719 | */ 720 | public var duration: TimeInterval{ 721 | guard let result = Double(self.stringFromEvaluatingJavaScript(jsToExecute: "player.getDuration();")) else { 722 | return 0 723 | } 724 | return result 725 | } 726 | 727 | 728 | /** 729 | * Returns the YouTube.com URL for the video. This method corresponds 730 | * to the JavaScript API defined here: 731 | * https://developers.google.com/youtube/iframe_api_reference#getVideoUrl 732 | * 733 | * @return The YouTube.com URL for the video. Returns nil if no video is loaded yet. 734 | */ 735 | public var videoUrl: URL?{ 736 | guard let url = URL(string: self.stringFromEvaluatingJavaScript(jsToExecute: "player.getVideoUrl();")) else{ 737 | return nil 738 | } 739 | return url 740 | } 741 | 742 | /** 743 | * Returns the embed code for the current video. This method corresponds 744 | * to the JavaScript API defined here: 745 | * https://developers.google.com/youtube/iframe_api_reference#getVideoEmbedCode 746 | * 747 | * @return The embed code for the current video. Returns nil if no video is loaded yet. 748 | */ 749 | public var videoEmbedCode: String{ 750 | return self.stringFromEvaluatingJavaScript(jsToExecute: "player.getVideoEmbedCode();") 751 | } 752 | 753 | //MARK:- Retrieving playlist information 754 | 755 | // Retrieving playlist information. These methods correspond to the 756 | // JavaScript defined here: 757 | // https://developers.google.com/youtube/js_api_reference#Retrieving_playlist_information 758 | 759 | /** 760 | * Returns an ordered array of video IDs in the playlist. This method corresponds 761 | * to the JavaScript API defined here: 762 | * https://developers.google.com/youtube/iframe_api_reference#getPlaylist 763 | * 764 | * @return An NSArray containing all the video IDs in the current playlist. |nil| on error. 765 | */ 766 | public func playlist() -> [String]?{ 767 | let returnValue = self.stringFromEvaluatingJavaScript(jsToExecute: "player.getPlaylist();") 768 | 769 | do { 770 | guard let playlistData = returnValue.data(using: .utf8) else{ 771 | return nil 772 | } 773 | 774 | let videoIds = try JSONSerialization.jsonObject(with: playlistData, options: []) 775 | 776 | return videoIds as? [String] 777 | } catch { 778 | return nil 779 | } 780 | } 781 | 782 | /** 783 | * Returns the 0-based index of the currently playing item in the playlist. 784 | * This method corresponds to the JavaScript API defined here: 785 | * https://developers.google.com/youtube/iframe_api_reference#getPlaylistIndex 786 | * 787 | * @return The 0-based index of the currently playing item in the playlist. 788 | */ 789 | public func playlistIndex() -> Int{ 790 | guard let result = Int(self.stringFromEvaluatingJavaScript(jsToExecute: "player.getPlaylistIndex();")) else { 791 | return 0 792 | } 793 | return result 794 | } 795 | 796 | /** 797 | * Private method for evaluating JavaScript in the WebView. 798 | * 799 | * @param jsToExecute The JavaScript code in string format that we want to execute. 800 | * @return JavaScript response from evaluating code. 801 | */ 802 | private func stringFromEvaluatingJavaScript(jsToExecute: String) -> String{ 803 | guard let result = self.webView.stringByEvaluatingJavaScript(from: jsToExecute) else{ 804 | return "" 805 | } 806 | return result 807 | } 808 | 809 | /** 810 | * Private method to convert a Swift BOOL value to JS boolean value. 811 | * 812 | * @param boolValue Swift BOOL value. 813 | * @return JavaScript Boolean value, i.e. "true" or "false". 814 | */ 815 | private func stringForJSBoolean(boolValue: Bool) -> String{ 816 | return boolValue ? "true" : "false"; 817 | } 818 | 819 | //MARK:- private methods 820 | private func createNewWebView() -> UIWebView{ 821 | let webView = UIWebView(frame: self.bounds) 822 | webView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 823 | webView.scrollView.isScrollEnabled = false 824 | webView.scrollView.bounces = false 825 | 826 | if let delegate = self.delegate{ 827 | webView.backgroundColor = delegate.playerViewPreferredWebViewBackgroundColor(self) 828 | if webView.backgroundColor == .clear{ 829 | webView.isOpaque = false 830 | } 831 | } 832 | return webView 833 | } 834 | 835 | /** 836 | * Private method to handle "navigation" to a callback URL of the format 837 | * ytplayer://action?data=someData 838 | * This is how the UIWebView communicates with the containing Swift code. 839 | * Side effects of this method are that it calls methods on this class's delegate. 840 | * 841 | * @param url A URL of the format ytplayer://action?data=value. 842 | */ 843 | func notifyDelegateOfYouTubeCallbackUrl(url: URL){ 844 | let query = url.query 845 | 846 | var data: String? = nil 847 | if let query = query{ 848 | data = query.components(separatedBy: "=")[1] 849 | } 850 | 851 | if let action = url.host, let callback = YTPlayerCallback(rawValue: action){ 852 | switch callback{ 853 | case .onReady: 854 | if self.initialLoadingView != nil{ 855 | self.initialLoadingView?.removeFromSuperview() 856 | } 857 | self.delegate?.playerViewDidBecomeReady(self) 858 | case .onStateChange: 859 | var playerState = YTPlayerState.unknown 860 | if let data = data, let state = YTPlayerState(rawValue: data){ 861 | playerState = state 862 | } 863 | self.delegate?.playerView(self, didChangeTo: playerState) 864 | case .onPlaybackQualityChange: 865 | var playerQuality = YTPlaybackQuality.unknown 866 | if let data = data, let quality = YTPlaybackQuality(rawValue: data){ 867 | playerQuality = quality 868 | } 869 | self.delegate?.playerView(self, didChangeTo: playerQuality) 870 | case .onError: 871 | var playerError = YTPlayerError.unknown 872 | if let data = data, let error = YTPlayerError(rawValue: data){ 873 | playerError = error 874 | } 875 | self.delegate?.playerView(self, receivedError: playerError) 876 | case .onPlayTime: 877 | if let data = data, let time = Float(data){ 878 | self.delegate?.playerView(self, didPlayTime: time) 879 | } 880 | case .onYouTubeIframeAPIFailedToLoad: 881 | self.initialLoadingView?.removeFromSuperview() 882 | default: 883 | break 884 | 885 | } 886 | } 887 | } 888 | 889 | func handleHttpNavigationToUrl(url: URL) -> Bool{ 890 | // Usually this means the user has clicked on the YouTube logo or an error message in the 891 | // player. Most URLs should open in the browser. The only http(s) URL that should open in this 892 | // UIWebView is the URL for the embed, which is of the format: 893 | // http(s)://www.youtube.com/embed/[VIDEO ID]?[PARAMETERS] 894 | 895 | let absoluteString = url.absoluteString 896 | 897 | 898 | do { 899 | let ytRegex = try NSRegularExpression(pattern: YTRegexPatterns.embedUrl.rawValue, options: .caseInsensitive) 900 | let ytMatch = ytRegex.firstMatch(in: absoluteString, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, absoluteString.count)) 901 | 902 | let adRegex = try NSRegularExpression(pattern: YTRegexPatterns.adUrl.rawValue, options: .caseInsensitive) 903 | let adMatch = adRegex.firstMatch(in: absoluteString, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, absoluteString.count)) 904 | 905 | let syndicationRegex = try NSRegularExpression(pattern: YTRegexPatterns.syndication.rawValue, options: .caseInsensitive) 906 | let syndicationMatch = syndicationRegex.firstMatch(in: absoluteString, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, absoluteString.count)) 907 | 908 | let oauthRegex = try NSRegularExpression(pattern: YTRegexPatterns.oAuth.rawValue, options: .caseInsensitive) 909 | let oauthMatch = oauthRegex.firstMatch(in: absoluteString, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, absoluteString.count)) 910 | 911 | let staticProxyRegex = try NSRegularExpression(pattern: YTRegexPatterns.staticProxy.rawValue, options: .caseInsensitive) 912 | let staticProxyMatch = staticProxyRegex.firstMatch(in: absoluteString, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, absoluteString.count)) 913 | 914 | 915 | if ytMatch != nil || adMatch != nil || oauthMatch != nil || staticProxyMatch != nil || syndicationMatch != nil { 916 | return true 917 | }else{ 918 | return false 919 | } 920 | 921 | } catch { 922 | // regex was bad! 923 | return false 924 | } 925 | } 926 | 927 | /** 928 | * Private helper method to load an iframe player with the given player parameters. 929 | * 930 | * @param additionalPlayerParams An NSDictionary of parameters in addition to required parameters 931 | * to instantiate the HTML5 player with. This differs depending on 932 | * whether a single video or playlist is being loaded. 933 | * @return YES if successful, NO if not. 934 | */ 935 | private func loadWithPlayerParams(additionalPlayerParams:[String: Any]? = nil) -> Bool{ 936 | let playerCallbacks = [ 937 | "onReady" : "onReady", 938 | "onStateChange" : "onStateChange", 939 | "onPlaybackQualityChange" : "onPlaybackQualityChange", 940 | "onError" : "onPlayerError" 941 | ] 942 | 943 | var playerParams = [String : Any]() 944 | if let vars = additionalPlayerParams { 945 | playerParams = vars 946 | } 947 | 948 | if playerParams["height"] == nil{ 949 | playerParams["height"] = "100%" 950 | } 951 | 952 | if playerParams["width"] == nil{ 953 | playerParams["width"] = "100%" 954 | } 955 | playerParams["events"] = playerCallbacks 956 | 957 | if let vars = playerParams["playerVars"]{ 958 | var playerVars = [String: Any]() 959 | playerVars["playerVars"] = vars 960 | 961 | if let origin = playerVars["origin"] as? String{ 962 | self.originURL = URL(string: origin) 963 | }else{ 964 | self.originURL = URL(string: "about:blank") 965 | } 966 | }else{ 967 | playerParams["playerVars"] = [String: Any]() 968 | } 969 | 970 | self.webView?.removeFromSuperview() 971 | self.webView = createNewWebView() 972 | self.addSubview(self.webView) 973 | self.webView.scalesPageToFit = true 974 | let path: String! 975 | 976 | if UI_USER_INTERFACE_IDIOM() == .pad{ 977 | path = Bundle.frameworkBundle()?.path(forResource: "YTPlayerView-iframe-playerIPAD", ofType: "html") 978 | }else{ 979 | path = Bundle.frameworkBundle()?.path(forResource: "YTPlayerView-iframe-player", ofType: "html") 980 | } 981 | 982 | let embedHTMLTemplate: String! 983 | if let filepath = path { 984 | do { 985 | embedHTMLTemplate = try String(contentsOfFile: filepath) 986 | } catch(let err) { 987 | print("Received error rendering template: ", err) 988 | return false 989 | // contents could not be loaded 990 | } 991 | } else { 992 | // example.txt not found! 993 | print("File is not exist on path") 994 | return false 995 | } 996 | 997 | let jsonData:Data! 998 | 999 | do { 1000 | try jsonData = JSONSerialization.data(withJSONObject: playerParams, options: .prettyPrinted) 1001 | } catch(let err) { 1002 | print("Attempted configuration of player with invalid playerVars: ", playerParams, " \tError: ", err) 1003 | return false 1004 | // contents could not be loaded 1005 | } 1006 | 1007 | guard let playerVarsJsonString = String(data: jsonData, encoding: .utf8) else{ 1008 | print("Attempted configuration of player with invalid playerVars: ", playerParams) 1009 | return false 1010 | } 1011 | let embedHTML = String(format: embedHTMLTemplate, playerVarsJsonString) 1012 | self.webView.loadHTMLString(embedHTML, baseURL: self.originURL) 1013 | self.webView.delegate = self 1014 | self.webView.allowsInlineMediaPlayback = true 1015 | self.webView.mediaPlaybackRequiresUserAction = false 1016 | 1017 | if let delegate = self.delegate{ 1018 | if let loadingView = delegate.playerViewPreferredInitialLoadingView(self){ 1019 | loadingView.frame = self.bounds 1020 | loadingView.autoresizingMask = [.flexibleWidth, .flexibleHeight] 1021 | self.addSubview(loadingView) 1022 | self.initialLoadingView = loadingView 1023 | } 1024 | } 1025 | return true 1026 | } 1027 | 1028 | /** 1029 | * Private method for cueing both cases of playlist ID and array of video IDs. Cueing 1030 | * a playlist does not start playback. 1031 | * 1032 | * @param cueingString A JavaScript string representing an array, playlist ID or list of 1033 | * video IDs to play with the playlist player. 1034 | * @param index 0-index position of video to start playback on. 1035 | * @param startSeconds Seconds after start of video to begin playback. 1036 | * @param suggestedQuality Suggested YTPlaybackQuality to play the videos. 1037 | * @return The result of cueing the playlist. 1038 | */ 1039 | private func cuePlaylist(cueingString: String, index: Int, startSeconds: Float, suggestedQuality: YTPlaybackQuality ){ 1040 | let indexValue = NSNumber(integerLiteral: index).stringValue 1041 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 1042 | let qualityValue = suggestedQuality.rawValue 1043 | let command = String(format: "player.cuePlaylist(%@, %@, %@, '%@');", cueingString, indexValue, startSecondsValue, qualityValue) 1044 | 1045 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 1046 | } 1047 | 1048 | /** 1049 | * Private method for loading both cases of playlist ID and array of video IDs. Loading 1050 | * a playlist automatically starts playback. 1051 | * 1052 | * @param cueingString A JavaScript string representing an array, playlist ID or list of 1053 | * video IDs to play with the playlist player. 1054 | * @param index 0-index position of video to start playback on. 1055 | * @param startSeconds Seconds after start of video to begin playback. 1056 | * @param suggestedQuality Suggested YTPlaybackQuality to play the videos. 1057 | * @return The result of cueing the playlist. 1058 | */ 1059 | private func loadPlaylist(cueingString: String, index: Int, startSeconds: Float, suggestedQuality: YTPlaybackQuality ){ 1060 | let indexValue = NSNumber(integerLiteral: index).stringValue 1061 | let startSecondsValue = NSNumber(value: startSeconds).stringValue 1062 | let qualityValue = suggestedQuality.rawValue 1063 | let command = String(format: "player.loadPlaylist(%@, %@, %@, '%@');", cueingString, indexValue, startSecondsValue, qualityValue) 1064 | 1065 | _ = self.stringFromEvaluatingJavaScript(jsToExecute: command) 1066 | } 1067 | 1068 | /** 1069 | * Private helper method for converting an NSArray of video IDs into its JavaScript equivalent. 1070 | * 1071 | * @param videoIds An array of video ID strings to convert into JavaScript format. 1072 | * @return A JavaScript array in String format containing video IDs. 1073 | */ 1074 | private func stringFromVideoIdArray(videoIds: [String]) -> String{ 1075 | var formattedVideoIds = [String]() 1076 | for vidId in videoIds{ 1077 | formattedVideoIds.append(String(format: "'%@'", vidId)) 1078 | } 1079 | 1080 | return String(format: "[%@]", formattedVideoIds.joined(separator: ", ")) 1081 | } 1082 | 1083 | } 1084 | 1085 | extension YTPlayerView: UIWebViewDelegate{ 1086 | public func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool{ 1087 | guard let url = request.url else { 1088 | return true 1089 | } 1090 | 1091 | if url.host == self.originURL.host{ 1092 | return true 1093 | }else if url.scheme == "ytplayer"{ 1094 | self.notifyDelegateOfYouTubeCallbackUrl(url: url) 1095 | return false 1096 | }else if url.scheme == "http" || url.scheme == "https"{ 1097 | return self.handleHttpNavigationToUrl(url: url) 1098 | } 1099 | return true 1100 | } 1101 | 1102 | public func webView(_ webView: UIWebView, didFailLoadWithError error: Error){ 1103 | self.initialLoadingView?.removeFromSuperview() 1104 | } 1105 | } 1106 | 1107 | extension Bundle{ 1108 | class func frameworkBundle() -> Bundle?{ 1109 | guard let mainBundlePath = Bundle(for: YTPlayerView.self).resourcePath else { 1110 | return nil 1111 | } 1112 | let frameworkBundlePath = mainBundlePath.appending("/youtube-ios-player-helper-swift.bundle") 1113 | return Bundle(path: frameworkBundlePath) 1114 | } 1115 | } 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | --------------------------------------------------------------------------------