diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 9b8ae31..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/Code/VideoPlayerKit.h b/Code/VideoPlayerKit.h index 331e425..d9ad282 100644 --- a/Code/VideoPlayerKit.h +++ b/Code/VideoPlayerKit.h @@ -17,6 +17,7 @@ @property (readwrite, strong) AVPlayer *videoPlayer; - (void)playVideoWithTitle:(NSString *)title URL:(NSURL *)url videoID:(NSString *)videoID shareURL:(NSURL *)shareURL isStreaming:(BOOL)streaming playInFullScreen:(BOOL)playInFullScreen; +- (void)playVideoWithTitle:(NSString *)title URL:(NSURL *)url videoID:(NSString *)videoID shareURL:(NSURL *)shareURL isStreaming:(BOOL)streaming playInFullScreen:(BOOL)playInFullScreen isAlwaysFullscreen:(BOOL)isAlwaysFullscreen; - (void)syncFullScreenButton:(UIInterfaceOrientation)toInterfaceOrientation; - (void)showCannotFetchStreamError; - (void)launchFullScreen; diff --git a/Code/VideoPlayerKit.m b/Code/VideoPlayerKit.m index f1fa1f7..8dd00e5 100644 --- a/Code/VideoPlayerKit.m +++ b/Code/VideoPlayerKit.m @@ -31,6 +31,7 @@ @interface VideoPlayerKit () @property (nonatomic) CGRect previousBounds; @property (nonatomic) BOOL hideTopViewWithControls; + @end @implementation VideoPlayerKit { @@ -125,6 +126,7 @@ - (void)loadView self.videoPlayerView = [[VideoPlayerView alloc] initWithFrame:CGRectZero]; } self.view = self.videoPlayerView; + self.view.backgroundColor = [UIColor blackColor]; } - (void)viewDidLoad @@ -188,7 +190,7 @@ - (void)shareButtonHandler } } -- (void)playVideoWithTitle:(NSString *)title URL:(NSURL *)url videoID:(NSString *)videoID shareURL:(NSURL *)shareURL isStreaming:(BOOL)streaming playInFullScreen:(BOOL)playInFullScreen +- (void)playVideoWithTitle:(NSString *)title URL:(NSURL *)url videoID:(NSString *)videoID shareURL:(NSURL *)shareURL isStreaming:(BOOL)streaming playInFullScreen:(BOOL)playInFullScreen isAlwaysFullscreen:(BOOL)isAlwaysFullscreen { [self.videoPlayer pause]; @@ -225,10 +227,22 @@ - (void)playVideoWithTitle:(NSString *)title URL:(NSURL *)url videoID:(NSString [self syncPlayPauseButtons]; + self.isAlwaysFullscreen = isAlwaysFullscreen; + if (playInFullScreen) { - self.isAlwaysFullscreen = YES; [self launchFullScreen]; } + else + { + self.fullScreenModeToggled = YES; + self.previousBounds = self.view.bounds; + [self minimizeVideo]; + } +} + +- (void)playVideoWithTitle:(NSString *)title URL:(NSURL *)url videoID:(NSString *)videoID shareURL:(NSURL *)shareURL isStreaming:(BOOL)streaming playInFullScreen:(BOOL)playInFullScreen +{ + [self playVideoWithTitle:title URL:url videoID:videoID shareURL:shareURL isStreaming:streaming playInFullScreen:playInFullScreen isAlwaysFullscreen:YES]; } - (void)showCannotFetchStreamError @@ -265,24 +279,27 @@ - (void)launchFullScreen if (!self.fullScreenModeToggled) { self.fullScreenModeToggled = YES; - if (!self.isAlwaysFullscreen) { - [self hideControlsAnimated:YES]; - } - [self syncFullScreenButton:[[UIApplication sharedApplication] statusBarOrientation]]; - if (!self.fullscreenViewController) { - self.fullscreenViewController = [[FullScreenViewController alloc] init]; - self.fullscreenViewController.allowPortraitFullscreen = self.allowPortraitFullscreen; + if (self.isAlwaysFullscreen) + { + if (!self.fullscreenViewController) { + self.fullscreenViewController = [[FullScreenViewController alloc] init]; + self.fullscreenViewController.allowPortraitFullscreen = self.allowPortraitFullscreen; + } + + [self.videoPlayerView setFullscreen:YES]; + [self.fullscreenViewController.view addSubview:self.videoPlayerView]; + } + else + { + [self.videoPlayerView setFullscreen:YES]; } - - [self.videoPlayerView setFullscreen:YES]; - [self.fullscreenViewController.view addSubview:self.videoPlayerView]; if (self.topView) { [self.topView removeFromSuperview]; - [self.fullscreenViewController.view addSubview:self.topView]; + [self.videoPlayerView addSubview:self.topView]; } if (self.isAlwaysFullscreen) { @@ -299,8 +316,9 @@ - (void)launchFullScreen completion:nil]; } - [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:self.fullscreenViewController animated:YES completion:^{ - if (self.isAlwaysFullscreen) { + if (self.isAlwaysFullscreen) + { + [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:self.fullscreenViewController animated:YES completion:^{ self.videoPlayerView.frame = CGRectMake(self.videoPlayerView.superview.bounds.size.width / 2, self.videoPlayerView.superview.bounds.size.height / 2, 0, 0); self.previousBounds = CGRectMake(self.videoPlayerView.superview.bounds.size.width / 2, self.videoPlayerView.superview.bounds.size.height / 2, 0, 0); [self.videoPlayerView setCenter:CGPointMake( self.videoPlayerView.superview.bounds.size.width / 2, self.videoPlayerView.superview.bounds.size.height / 2)]; @@ -313,8 +331,18 @@ - (void)launchFullScreen completion:nil]; self.videoPlayerView.frame = self.videoPlayerView.superview.bounds; - } - + + if (self.topView) { + self.topView.frame = CGRectMake(0, 0, self.videoPlayerView.frame.size.width, self.topView.frame.size.height); + } + + if ([self.delegate respondsToSelector:@selector(setFullScreenToggled:)]) { + [self.delegate setFullScreenToggled:self.fullScreenModeToggled]; + } + }]; + } + else + { if (self.topView) { self.topView.frame = CGRectMake(0, 0, self.videoPlayerView.frame.size.width, self.topView.frame.size.height); } @@ -322,7 +350,8 @@ - (void)launchFullScreen if ([self.delegate respondsToSelector:@selector(setFullScreenToggled:)]) { [self.delegate setFullScreenToggled:self.fullScreenModeToggled]; } - }]; + + } } } @@ -331,11 +360,11 @@ - (void)minimizeVideo if (self.fullScreenModeToggled) { self.fullScreenModeToggled = NO; [self.videoPlayerView setFullscreen:NO]; - [self hideControlsAnimated:NO]; [self syncFullScreenButton:self.interfaceOrientation]; if (self.topView) { - [self.containingViewController.view addSubview:self.topView]; + [self.topView removeFromSuperview]; + [self.videoPlayerView addSubview:self.topView]; } if (self.isAlwaysFullscreen) { @@ -353,6 +382,18 @@ - (void)minimizeVideo [self.videoPlayerView removeFromSuperview]; }]; + [[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:self.isAlwaysFullscreen completion:^{ + + if (!self.isAlwaysFullscreen) { + [self showControls]; + } + [[UIApplication sharedApplication] setStatusBarHidden:NO + withAnimation:UIStatusBarAnimationFade]; + + if ([self.delegate respondsToSelector:@selector(setFullScreenToggled:)]) { + [self.delegate setFullScreenToggled:self.fullScreenModeToggled]; + } + }]; } else { [UIView animateWithDuration:0.45f delay:0.0f @@ -364,25 +405,17 @@ - (void)minimizeVideo if (showShareOptions) { [self presentShareOptions]; } + if (self.topView) { + self.topView.frame = CGRectMake(0, 0, self.videoPlayerView.frame.size.width, self.topView.frame.size.height); + } }]; [self.videoPlayerView removeFromSuperview]; [self.containingViewController.view addSubview:self.videoPlayerView]; } - - - [[UIApplication sharedApplication].keyWindow.rootViewController dismissViewControllerAnimated:self.isAlwaysFullscreen completion:^{ - - if (!self.isAlwaysFullscreen) { - [self showControls]; - } - [[UIApplication sharedApplication] setStatusBarHidden:NO - withAnimation:UIStatusBarAnimationFade]; - - if ([self.delegate respondsToSelector:@selector(setFullScreenToggled:)]) { - [self.delegate setFullScreenToggled:self.fullScreenModeToggled]; - } - }]; + if (self.topView) { + self.topView.frame = CGRectMake(0, 0, self.videoPlayerView.frame.size.width, self.topView.frame.size.height); + } } } diff --git a/VideoPlayerKitSampleProject/.DS_Store b/VideoPlayerKitSampleProject/.DS_Store index d2d7ead..92400e3 100644 Binary files a/VideoPlayerKitSampleProject/.DS_Store and b/VideoPlayerKitSampleProject/.DS_Store differ diff --git a/VideoPlayerKitSampleProject/.bundle/config b/VideoPlayerKitSampleProject/.bundle/config new file mode 100644 index 0000000..0fe692f --- /dev/null +++ b/VideoPlayerKitSampleProject/.bundle/config @@ -0,0 +1,3 @@ +--- +BUNDLE_DISABLE_SHARED_GEMS: "1" +BUNDLE_PATH: /Users/aserbin/Documents/Work/VideoPlayerKitMyGit/VideoPlayerKitSampleProject/cache diff --git a/VideoPlayerKitSampleProject/Podfile b/VideoPlayerKitSampleProject/Podfile index f8e6662..26ea323 100644 --- a/VideoPlayerKitSampleProject/Podfile +++ b/VideoPlayerKitSampleProject/Podfile @@ -2,4 +2,4 @@ platform :ios, '5.0' inhibit_all_warnings! -pod "VideoPlayerKit", :git => 'https://github.com/ign/VideoPlayerKit.git' \ No newline at end of file +pod "VideoPlayerKit", :git => 'https://github.com/aserbin/VideoPlayerKit.git' \ No newline at end of file diff --git a/VideoPlayerKitSampleProject/Podfile.lock b/VideoPlayerKitSampleProject/Podfile.lock index e449e81..5dd50a0 100644 --- a/VideoPlayerKitSampleProject/Podfile.lock +++ b/VideoPlayerKitSampleProject/Podfile.lock @@ -1,30 +1,29 @@ +PODS: + - cocoa-oauth (0.0.1): + - NSData+Base64 (~> 1.0) + - Facebook-iOS-SDK (3.1.1) + - NSData+Base64 (1.0.0) + - REComposeViewController (0.0.1) + - ShareThis (1.0.0): + - cocoa-oauth (= 0.0.1) + - Facebook-iOS-SDK (= 3.1.1) + - REComposeViewController (= 0.0.1) + - VideoPlayerKit (1.0.0): + - ShareThis (= 1.0.0) -COCOAPODS: 0.16.1 +DEPENDENCIES: + - VideoPlayerKit (from `https://github.com/aserbin/VideoPlayerKit.git`) -DEPENDENCIES: -- VideoPlayerKit (from `https://github.com/ign/VideoPlayerKit.git') +EXTERNAL SOURCES: + VideoPlayerKit: + :git: https://github.com/aserbin/VideoPlayerKit.git -PODS: -- Facebook-iOS-SDK (3.1.1) -- NSData+Base64 (1.0.0) -- REComposeViewController (0.0.1) -- ShareThis (1.0.0): - - Facebook-iOS-SDK (= 3.1.1) - - REComposeViewController (= 0.0.1) - - cocoa-oauth (= 0.0.1) -- VideoPlayerKit (1.0.0): - - ShareThis (= 1.0.0) -- cocoa-oauth (0.0.1): - - NSData+Base64 (~> 1.0) - -SPEC CHECKSUMS: - NSData+Base64: 8b910cb8a64f45daec6fb15936c36a9a911c57ca - Facebook-iOS-SDK: 5fc068ebfd8c8c9b0fad476bc36dbbf1fffeebc8 +SPEC CHECKSUMS: cocoa-oauth: 8f4c8b77c77ac660de37f8125557c4ec09b0118a + Facebook-iOS-SDK: 5fc068ebfd8c8c9b0fad476bc36dbbf1fffeebc8 + NSData+Base64: 36c4e5b6479259c1a68866ccd2a8dd385c9744f7 REComposeViewController: 346eb738a68ddcce77b3d771695a91c7af1a5701 ShareThis: 9df4a93ea65a676c9e852588d98d35e4831b7636 - VideoPlayerKit: df22855ccb0a286e7b9c20a439ebd73b7c78d00c + VideoPlayerKit: 8fd3d6feb81303cf971426aff830c1e9a6984247 -EXTERNAL SOURCES: - VideoPlayerKit: - :git: https://github.com/ign/VideoPlayerKit.git +COCOAPODS: 0.22.2 diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/project.pbxproj b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/project.pbxproj index 20dbcdf..3ecf91d 100644 --- a/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/project.pbxproj +++ b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/project.pbxproj @@ -19,6 +19,19 @@ 76D67AF5165419CA00CAC69A /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 76D67AF4165419CA00CAC69A /* Default@2x.png */; }; 76D67AF7165419CA00CAC69A /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 76D67AF6165419CA00CAC69A /* Default-568h@2x.png */; }; 76D67B0216541A0200CAC69A /* VideoPlayerSampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 76D67B0116541A0200CAC69A /* VideoPlayerSampleViewController.m */; }; + EBB14C79170BB6730007249C /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C78170BB6730007249C /* AVFoundation.framework */; }; + EBB14C7B170BB67A0007249C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C7A170BB67A0007249C /* AudioToolbox.framework */; }; + EBB14C7D170BB6890007249C /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C7C170BB6890007249C /* CoreLocation.framework */; }; + EBB14C7F170BB6930007249C /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C7E170BB6930007249C /* CoreMedia.framework */; }; + EBB14C81170BB69B0007249C /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C80170BB69B0007249C /* MediaPlayer.framework */; }; + EBB14C83170BB6A10007249C /* MessageUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C82170BB6A10007249C /* MessageUI.framework */; }; + EBB14C85170BB6A70007249C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C84170BB6A70007249C /* QuartzCore.framework */; }; + EBB14C87170BB6AC0007249C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C86170BB6AC0007249C /* Security.framework */; }; + EBB14C89170BB6B10007249C /* Twitter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C88170BB6B10007249C /* Twitter.framework */; }; + EBB14C8B170BB6B70007249C /* Accounts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C8A170BB6B70007249C /* Accounts.framework */; }; + EBB14C8D170BB6BC0007249C /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C8C170BB6BC0007249C /* AdSupport.framework */; }; + EBB14C8F170BB6C30007249C /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C8E170BB6C30007249C /* Social.framework */; }; + EBB14C91170BB6D90007249C /* libsqlite3.0.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = EBB14C90170BB6D90007249C /* libsqlite3.0.dylib */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -40,6 +53,19 @@ 76D67AF6165419CA00CAC69A /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 76D67B0016541A0200CAC69A /* VideoPlayerSampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoPlayerSampleViewController.h; sourceTree = ""; }; 76D67B0116541A0200CAC69A /* VideoPlayerSampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VideoPlayerSampleViewController.m; sourceTree = ""; }; + EBB14C78170BB6730007249C /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + EBB14C7A170BB67A0007249C /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + EBB14C7C170BB6890007249C /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + EBB14C7E170BB6930007249C /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + EBB14C80170BB69B0007249C /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; + EBB14C82170BB6A10007249C /* MessageUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MessageUI.framework; path = System/Library/Frameworks/MessageUI.framework; sourceTree = SDKROOT; }; + EBB14C84170BB6A70007249C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + EBB14C86170BB6AC0007249C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + EBB14C88170BB6B10007249C /* Twitter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Twitter.framework; path = System/Library/Frameworks/Twitter.framework; sourceTree = SDKROOT; }; + EBB14C8A170BB6B70007249C /* Accounts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accounts.framework; path = System/Library/Frameworks/Accounts.framework; sourceTree = SDKROOT; }; + EBB14C8C170BB6BC0007249C /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; + EBB14C8E170BB6C30007249C /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; }; + EBB14C90170BB6D90007249C /* libsqlite3.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.0.dylib; path = usr/lib/libsqlite3.0.dylib; sourceTree = SDKROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -47,9 +73,22 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + EBB14C91170BB6D90007249C /* libsqlite3.0.dylib in Frameworks */, + EBB14C8F170BB6C30007249C /* Social.framework in Frameworks */, + EBB14C8D170BB6BC0007249C /* AdSupport.framework in Frameworks */, + EBB14C8B170BB6B70007249C /* Accounts.framework in Frameworks */, + EBB14C89170BB6B10007249C /* Twitter.framework in Frameworks */, + EBB14C87170BB6AC0007249C /* Security.framework in Frameworks */, + EBB14C85170BB6A70007249C /* QuartzCore.framework in Frameworks */, + EBB14C83170BB6A10007249C /* MessageUI.framework in Frameworks */, + EBB14C81170BB69B0007249C /* MediaPlayer.framework in Frameworks */, + EBB14C7F170BB6930007249C /* CoreMedia.framework in Frameworks */, + EBB14C7D170BB6890007249C /* CoreLocation.framework in Frameworks */, + 76D67AE5165419CA00CAC69A /* CoreGraphics.framework in Frameworks */, + EBB14C7B170BB67A0007249C /* AudioToolbox.framework in Frameworks */, + EBB14C79170BB6730007249C /* AVFoundation.framework in Frameworks */, 76D67AE1165419CA00CAC69A /* UIKit.framework in Frameworks */, 76D67AE3165419CA00CAC69A /* Foundation.framework in Frameworks */, - 76D67AE5165419CA00CAC69A /* CoreGraphics.framework in Frameworks */, 44545B2C7C044D2C94C8F495 /* libPods.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -60,6 +99,19 @@ 76D67AD1165419CA00CAC69A = { isa = PBXGroup; children = ( + EBB14C90170BB6D90007249C /* libsqlite3.0.dylib */, + EBB14C8E170BB6C30007249C /* Social.framework */, + EBB14C8C170BB6BC0007249C /* AdSupport.framework */, + EBB14C8A170BB6B70007249C /* Accounts.framework */, + EBB14C88170BB6B10007249C /* Twitter.framework */, + EBB14C86170BB6AC0007249C /* Security.framework */, + EBB14C84170BB6A70007249C /* QuartzCore.framework */, + EBB14C82170BB6A10007249C /* MessageUI.framework */, + EBB14C80170BB69B0007249C /* MediaPlayer.framework */, + EBB14C7E170BB6930007249C /* CoreMedia.framework */, + EBB14C7C170BB6890007249C /* CoreLocation.framework */, + EBB14C7A170BB67A0007249C /* AudioToolbox.framework */, + EBB14C78170BB6730007249C /* AVFoundation.framework */, 76D67AE6165419CA00CAC69A /* VideoPlayerSample */, 76D67ADF165419CA00CAC69A /* Frameworks */, 76D67ADD165419CA00CAC69A /* Products */, @@ -240,6 +292,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/Pods/build/Debug-iphonesimulator\""; + PODS_BUILD_HEADERS_SEARCH_PATHS = "\"${PODS_ROOT}/BuildHeaders\" \"${PODS_ROOT}/BuildHeaders/Facebook-iOS-SDK\" \"${PODS_ROOT}/BuildHeaders/Facebook-iOS-SDK/FacebookSDK\" \"${PODS_ROOT}/BuildHeaders/NSData+Base64\" \"${PODS_ROOT}/BuildHeaders/REComposeViewController\" \"${PODS_ROOT}/BuildHeaders/ShareThis\" \"${PODS_ROOT}/BuildHeaders/VideoPlayerKit\" \"${PODS_ROOT}/BuildHeaders/cocoa-oauth\""; + PODS_ROOT = "${SRCROOT}/pods"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -261,7 +316,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 6.0; + LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/Pods/build/Debug-iphonesimulator\""; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PODS_BUILD_HEADERS_SEARCH_PATHS = "\"${PODS_ROOT}/BuildHeaders\" \"${PODS_ROOT}/BuildHeaders/Facebook-iOS-SDK\" \"${PODS_ROOT}/BuildHeaders/Facebook-iOS-SDK/FacebookSDK\" \"${PODS_ROOT}/BuildHeaders/NSData+Base64\" \"${PODS_ROOT}/BuildHeaders/REComposeViewController\" \"${PODS_ROOT}/BuildHeaders/ShareThis\" \"${PODS_ROOT}/BuildHeaders/VideoPlayerKit\" \"${PODS_ROOT}/BuildHeaders/cocoa-oauth\""; + PODS_ROOT = "${SRCROOT}/pods"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -275,11 +333,10 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", - "\"$(SRCROOT)/../../../Desktop/Cocoa_StreamStitcherDemo/StreamStitcherDemo\"", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "VideoPlayerSample/VideoPlayerSample-Prefix.pch"; - HEADER_SEARCH_PATHS = "${PODS_HEADERS_SEARCH_PATHS}"; + HEADER_SEARCH_PATHS = "$(PODS_BUILD_HEADERS_SEARCH_PATHS)"; INFOPLIST_FILE = "VideoPlayerSample/VideoPlayerSample-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 5.1; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -295,11 +352,10 @@ FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(SRCROOT)\"", - "\"$(SRCROOT)/../../../Desktop/Cocoa_StreamStitcherDemo/StreamStitcherDemo\"", ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "VideoPlayerSample/VideoPlayerSample-Prefix.pch"; - HEADER_SEARCH_PATHS = "${PODS_HEADERS_SEARCH_PATHS}"; + HEADER_SEARCH_PATHS = "$(PODS_BUILD_HEADERS_SEARCH_PATHS)"; INFOPLIST_FILE = "VideoPlayerSample/VideoPlayerSample-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 5.1; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/project.xcworkspace/xcuserdata/aserbin.xcuserdatad/UserInterfaceState.xcuserstate b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/project.xcworkspace/xcuserdata/aserbin.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..c641c23 Binary files /dev/null and b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/project.xcworkspace/xcuserdata/aserbin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcshareddata/xcschemes/VideoPlayerSample.xcscheme b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcshareddata/xcschemes/VideoPlayerSample.xcscheme new file mode 100644 index 0000000..d0f73f8 --- /dev/null +++ b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcshareddata/xcschemes/VideoPlayerSample.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcuserdata/aserbin.xcuserdatad/xcschemes/VideoPlayerSample.xcscheme b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcuserdata/aserbin.xcuserdatad/xcschemes/VideoPlayerSample.xcscheme new file mode 100644 index 0000000..d0f73f8 --- /dev/null +++ b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcuserdata/aserbin.xcuserdatad/xcschemes/VideoPlayerSample.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcuserdata/aserbin.xcuserdatad/xcschemes/xcschememanagement.plist b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcuserdata/aserbin.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..08eeac0 --- /dev/null +++ b/VideoPlayerKitSampleProject/VideoPlayerSample.xcodeproj/xcuserdata/aserbin.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + VideoPlayerSample.xcscheme + + orderHint + 1 + + VideoPlayerSample.xcscheme_^#shared#^_ + + orderHint + 0 + + + SuppressBuildableAutocreation + + 76D67ADB165419CA00CAC69A + + primary + + + + + diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/contents.xcworkspacedata b/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..628a292 --- /dev/null +++ b/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/xcuserdata/aserbin.xcuserdatad/UserInterfaceState.xcuserstate b/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/xcuserdata/aserbin.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..ec6dc65 Binary files /dev/null and b/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/xcuserdata/aserbin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/xcuserdata/aserbin.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/xcuserdata/aserbin.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 0000000..b26c534 --- /dev/null +++ b/VideoPlayerKitSampleProject/VideoPlayerSample.xcworkspace/xcuserdata/aserbin.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,14 @@ + + + + + + + diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.h b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.h index 1d238a7..16d2928 100644 --- a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.h +++ b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.h @@ -4,7 +4,8 @@ @interface VideoPlayerSampleView : UIView -@property (nonatomic, readonly, strong) UIButton *playButton; +@property (nonatomic, readonly, strong) UIButton *playInFullScreenButton; +@property (nonatomic, readonly, strong) UIButton *playInFrameButton; - (id)initWithTopView:(UIView *)topView videoPlayerView:(UIView *)videoPlayerView; @end diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.m b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.m index 1cedac0..af2e2b3 100644 --- a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.m +++ b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleView.m @@ -6,7 +6,8 @@ @interface VideoPlayerSampleView() @property (nonatomic, weak) UIView *topView; @property (nonatomic, weak) UIView *videoPlayerView; -@property (nonatomic, readwrite, strong) UIButton *playButton; +@property (nonatomic, readwrite, strong) UIButton *playInFullScreenButton; +@property (nonatomic, readwrite, strong) UIButton *playInFrameButton; @end @@ -15,10 +16,14 @@ @implementation VideoPlayerSampleView - (id)initWithTopView:(UIView *)topView videoPlayerView:(UIView *)videoPlayerView { if ((self = [super init])) { - self.playButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; - [self.playButton setTitle:@"Play Video" forState:UIControlStateNormal]; - [self addSubview:self.playButton]; + self.playInFullScreenButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + [self.playInFullScreenButton setTitle:@"Full screen" forState:UIControlStateNormal]; + [self addSubview:self.playInFullScreenButton]; self.backgroundColor = [UIColor whiteColor]; + + self.playInFrameButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; + [self.playInFrameButton setTitle:@"In frame" forState:UIControlStateNormal]; + [self addSubview:self.playInFrameButton]; } return self; @@ -28,11 +33,16 @@ - (void)layoutSubviews { [super layoutSubviews]; CGRect bounds = self.bounds; - self.playButton.frame = CGRectMake((bounds.size.width - 100)/2.0, - (bounds.size.height - 50)/2.0, + self.playInFullScreenButton.frame = CGRectMake(bounds.size.width/4.0 - 50, + (bounds.size.height - 150), 100, 50); + self.playInFrameButton.frame = CGRectMake(bounds.size.width/4.0 * 3 - 50, + (bounds.size.height - 150), + 100, + 50); + } @end diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.h b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.h index 929e8ea..f1d3016 100644 --- a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.h +++ b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.h @@ -7,4 +7,6 @@ @property (nonatomic) BOOL fullScreenToggled; +@property NSURL *address; + @end diff --git a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.m b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.m index 300b078..d5aaec4 100644 --- a/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.m +++ b/VideoPlayerKitSampleProject/VideoPlayerSample/VideoPlayerSampleViewController.m @@ -43,25 +43,34 @@ - (void)fullScreen - (void)loadView { self.videoPlayerSampleView = [[VideoPlayerSampleView alloc] initWithTopView:nil videoPlayerView:nil]; - [self.videoPlayerSampleView.playButton addTarget:self action:@selector(playVideo) forControlEvents:UIControlEventTouchUpInside]; + [self.videoPlayerSampleView.playInFullScreenButton addTarget:self action:@selector(playVideo:) forControlEvents:UIControlEventTouchUpInside]; + [self.videoPlayerSampleView.playInFrameButton addTarget:self action:@selector(playVideo:) forControlEvents:UIControlEventTouchUpInside]; [self setView:self.videoPlayerSampleView]; } -- (void)playVideo +- (void)playVideo:(id)owner { NSURL *url = [NSURL URLWithString:@"http://ignhdvod-f.akamaihd.net/i/assets.ign.com/videos/zencoder/,416/d4ff0368b5e4a24aee0dab7703d4123a-110000,640/d4ff0368b5e4a24aee0dab7703d4123a-500000,640/d4ff0368b5e4a24aee0dab7703d4123a-1000000,960/d4ff0368b5e4a24aee0dab7703d4123a-2500000,1280/d4ff0368b5e4a24aee0dab7703d4123a-3000000,-1354660143-w.mp4.csmil/master.m3u8"]; +// NSURL *url = [NSURL URLWithString:@"http://10.0.0.1/videohog/Ahfuck.mp4"]; + if (!self.videoPlayerViewController) { - self.videoPlayerViewController = [VideoPlayerKit videoPlayerWithContainingViewController:self optionalTopView:_topView hideTopViewWithControls:YES]; + self.videoPlayerViewController = [VideoPlayerKit videoPlayerWithContainingViewController:self optionalTopView:self.topView hideTopViewWithControls:YES]; // Need to set edge inset if top view is inserted [self.videoPlayerViewController setControlsEdgeInsets:UIEdgeInsetsMake(self.topView.frame.size.height, 0, 0, 0)]; self.videoPlayerViewController.delegate = self; self.videoPlayerViewController.allowPortraitFullscreen = YES; } + else + { + [self.videoPlayerViewController.view removeFromSuperview]; + } [self.view addSubview:self.videoPlayerViewController.view]; - [self.videoPlayerViewController playVideoWithTitle:@"Title" URL:url videoID:nil shareURL:nil isStreaming:NO playInFullScreen:YES]; + self.videoPlayerViewController.view.frame = CGRectMake(0, 0, self.view.bounds.size.width , self.view.bounds.size.height/2); + + [self.videoPlayerViewController playVideoWithTitle:@"Title" URL:url videoID:nil shareURL:nil isStreaming:NO playInFullScreen:owner == self.videoPlayerSampleView.playInFullScreenButton isAlwaysFullscreen:owner == self.videoPlayerSampleView.playInFullScreenButton]; } - (void)viewDidLoad