├── README.md ├── AVPlayerDemo ├── en.lproj │ └── InfoPlist.strings ├── ViewController.h ├── AppDelegate.h ├── PlayerView.h ├── main.m ├── AVPlayerDemo-Prefix.pch ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── PlayerView.m ├── AVPlayerDemo-Info.plist ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard └── ViewController.m ├── AVPlayerDemoTests ├── en.lproj │ └── InfoPlist.strings ├── AVPlayerDemoTests-Info.plist └── AVPlayerDemoTests.m └── AVPlayerDemo.xcodeproj ├── xcuserdata ├── mzds.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── AVPlayerDemo.xcscheme └── YiBan.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── xcschememanagement.plist │ └── AVPlayerDemo.xcscheme ├── project.xcworkspace ├── contents.xcworkspacedata ├── xcuserdata │ ├── YiBan.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ └── mzds.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcshareddata │ └── AVPlayerDemo.xccheckout └── project.pbxproj /README.md: -------------------------------------------------------------------------------- 1 | ### AVPlayerDemo 2 | A simple player use AVPlayer. -------------------------------------------------------------------------------- /AVPlayerDemo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AVPlayerDemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/xcuserdata/mzds.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/xcuserdata/YiBan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/project.xcworkspace/xcuserdata/YiBan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nintenace/AVPlayerDemo/HEAD/AVPlayerDemo.xcodeproj/project.xcworkspace/xcuserdata/YiBan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/project.xcworkspace/xcuserdata/mzds.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nintenace/AVPlayerDemo/HEAD/AVPlayerDemo.xcodeproj/project.xcworkspace/xcuserdata/mzds.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AVPlayerDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // AVPlayerDemo 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /AVPlayerDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AVPlayerDemo 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /AVPlayerDemo/PlayerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PlayerView.h 3 | // AVPlayerDemo 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface PlayerView : UIView 13 | 14 | @property (nonatomic ,strong) AVPlayer *player; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /AVPlayerDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AVPlayerDemo 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AVPlayerDemo/AVPlayerDemo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | 18 | static NSString *const RICH = @"http://www.jxvdy.com/file/upload/201405/05/18-24-58-42-627.mp4"; 19 | static NSString *const EYE = @"http://www.jxvdy.com/file/upload/201309/18/18-10-03-19-3.mp4"; 20 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/xcuserdata/YiBan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AVPlayerDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CD41BF4D19177EE0009C283A 16 | 17 | primary 18 | 19 | 20 | CD41BF6E19177EE0009C283A 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/xcuserdata/mzds.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AVPlayerDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | CD41BF4D19177EE0009C283A 16 | 17 | primary 18 | 19 | 20 | CD41BF6E19177EE0009C283A 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /AVPlayerDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "size" : "29x29", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "size" : "29x29", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "40x40", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "40x40", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "76x76", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "76x76", 31 | "scale" : "2x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /AVPlayerDemoTests/AVPlayerDemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | cn.yiban.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /AVPlayerDemoTests/AVPlayerDemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // AVPlayerDemoTests.m 3 | // AVPlayerDemoTests 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AVPlayerDemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation AVPlayerDemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /AVPlayerDemo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "1x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "extent" : "full-screen", 14 | "minimum-system-version" : "7.0", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "portrait", 19 | "idiom" : "ipad", 20 | "extent" : "full-screen", 21 | "minimum-system-version" : "7.0", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "landscape", 26 | "idiom" : "ipad", 27 | "extent" : "full-screen", 28 | "minimum-system-version" : "7.0", 29 | "scale" : "2x" 30 | } 31 | ], 32 | "info" : { 33 | "version" : 1, 34 | "author" : "xcode" 35 | } 36 | } -------------------------------------------------------------------------------- /AVPlayerDemo/PlayerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PlayerView.m 3 | // AVPlayerDemo 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import "PlayerView.h" 10 | 11 | @implementation PlayerView 12 | 13 | - (id)initWithFrame:(CGRect)frame 14 | { 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | // Initialization code 18 | } 19 | return self; 20 | } 21 | 22 | + (Class)layerClass { 23 | return [AVPlayerLayer class]; 24 | } 25 | 26 | - (AVPlayer *)player { 27 | return [(AVPlayerLayer *)[self layer] player]; 28 | } 29 | 30 | - (void)setPlayer:(AVPlayer *)player { 31 | [(AVPlayerLayer *)[self layer] setPlayer:player]; 32 | } 33 | 34 | /* 35 | // Only override drawRect: if you perform custom drawing. 36 | // An empty implementation adversely affects performance during animation. 37 | - (void)drawRect:(CGRect)rect 38 | { 39 | // Drawing code 40 | } 41 | */ 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /AVPlayerDemo/AVPlayerDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | cn.yiban.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationLandscapeLeft 36 | UIInterfaceOrientationLandscapeRight 37 | 38 | NSAppTransportSecurity 39 | 40 | NSAllowsArbitraryLoads 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/project.xcworkspace/xcshareddata/AVPlayerDemo.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 2A4872B7-4D25-4124-91B7-7E9A6F544213 9 | IDESourceControlProjectName 10 | AVPlayerDemo 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 06525B17738774D11BE8B90B6D7AECB85A778658 14 | https://github.com/mzds/AVPlayerDemo.git 15 | 16 | IDESourceControlProjectPath 17 | AVPlayerDemo.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 06525B17738774D11BE8B90B6D7AECB85A778658 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/mzds/AVPlayerDemo.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 06525B17738774D11BE8B90B6D7AECB85A778658 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 06525B17738774D11BE8B90B6D7AECB85A778658 36 | IDESourceControlWCCName 37 | AVPlayerDemo 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /AVPlayerDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AVPlayerDemo 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/xcuserdata/YiBan.xcuserdatad/xcschemes/AVPlayerDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/xcuserdata/mzds.xcuserdatad/xcschemes/AVPlayerDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /AVPlayerDemo/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 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /AVPlayerDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // AVPlayerDemo 4 | // 5 | // Created by CaoJie on 14-5-5. 6 | // Copyright (c) 2014年 yiban. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import 11 | #import "PlayerView.h" 12 | 13 | // http://v.jxvdy.com/sendfile/w5bgP3A8JgiQQo5l0hvoNGE2H16WbN09X-ONHPq3P3C1BISgf7C-qVs6_c8oaw3zKScO78I--b0BGFBRxlpw13sf2e54QA 14 | 15 | @interface ViewController () { 16 | BOOL _played; 17 | NSString *_totalTime; 18 | NSDateFormatter *_dateFormatter; 19 | } 20 | 21 | @property (nonatomic ,strong) AVPlayer *player; 22 | @property (nonatomic ,strong) AVPlayerItem *playerItem; 23 | @property (nonatomic ,weak) IBOutlet PlayerView *playerView; 24 | @property (nonatomic ,weak) IBOutlet UIButton *stateButton; 25 | @property (nonatomic ,weak) IBOutlet UILabel *timeLabel; 26 | @property (nonatomic ,strong) id playbackTimeObserver; 27 | @property (nonatomic ,weak) IBOutlet UISlider *videoSlider; 28 | @property (nonatomic ,weak) IBOutlet UIProgressView *videoProgress; 29 | 30 | 31 | - (IBAction)stateButtonTouched:(id)sender; 32 | - (IBAction)videoSlierChangeValue:(id)sender; 33 | - (IBAction)videoSlierChangeValueEnd:(id)sender; 34 | 35 | @end 36 | 37 | @implementation ViewController 38 | 39 | - (void)viewDidLoad 40 | { 41 | [super viewDidLoad]; 42 | 43 | NSURL *videoUrl = [NSURL URLWithString:@"http://v.jxvdy.com/sendfile/w5bgP3A8JgiQQo5l0hvoNGE2H16WbN09X-ONHPq3P3C1BISgf7C-qVs6_c8oaw3zKScO78I--b0BGFBRxlpw13sf2e54QA"]; 44 | self.playerItem = [AVPlayerItem playerItemWithURL:videoUrl]; 45 | [self.playerItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];// 监听status属性 46 | [self.playerItem addObserver:self forKeyPath:@"loadedTimeRanges" options:NSKeyValueObservingOptionNew context:nil];// 监听loadedTimeRanges属性 47 | self.player = [AVPlayer playerWithPlayerItem:self.playerItem]; 48 | self.playerView.player = _player; 49 | self.stateButton.enabled = NO; 50 | 51 | // 添加视频播放结束通知 52 | [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(moviePlayDidEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:_playerItem]; 53 | } 54 | 55 | - (void)viewDidAppear:(BOOL)animated { 56 | [super viewDidAppear:animated]; 57 | } 58 | 59 | - (void)monitoringPlayback:(AVPlayerItem *)playerItem { 60 | 61 | __weak typeof(self) weakSelf = self; 62 | self.playbackTimeObserver = [self.playerView.player addPeriodicTimeObserverForInterval:CMTimeMake(1, 1) queue:NULL usingBlock:^(CMTime time) { 63 | CGFloat currentSecond = playerItem.currentTime.value/playerItem.currentTime.timescale;// 计算当前在第几秒 64 | [weakSelf.videoSlider setValue:currentSecond animated:YES]; 65 | NSString *timeString = [self convertTime:currentSecond]; 66 | weakSelf.timeLabel.text = [NSString stringWithFormat:@"%@/%@",timeString,_totalTime]; 67 | }]; 68 | } 69 | 70 | // KVO方法 71 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 72 | AVPlayerItem *playerItem = (AVPlayerItem *)object; 73 | if ([keyPath isEqualToString:@"status"]) { 74 | if ([playerItem status] == AVPlayerStatusReadyToPlay) { 75 | NSLog(@"AVPlayerStatusReadyToPlay"); 76 | self.stateButton.enabled = YES; 77 | CMTime duration = self.playerItem.duration;// 获取视频总长度 78 | CGFloat totalSecond = playerItem.duration.value / playerItem.duration.timescale;// 转换成秒 79 | _totalTime = [self convertTime:totalSecond];// 转换成播放时间 80 | [self customVideoSlider:duration];// 自定义UISlider外观 81 | NSLog(@"movie total duration:%f",CMTimeGetSeconds(duration)); 82 | [self monitoringPlayback:self.playerItem];// 监听播放状态 83 | } else if ([playerItem status] == AVPlayerStatusFailed) { 84 | NSLog(@"AVPlayerStatusFailed"); 85 | } 86 | } else if ([keyPath isEqualToString:@"loadedTimeRanges"]) { 87 | NSTimeInterval timeInterval = [self availableDuration];// 计算缓冲进度 88 | NSLog(@"Time Interval:%f",timeInterval); 89 | CMTime duration = _playerItem.duration; 90 | CGFloat totalDuration = CMTimeGetSeconds(duration); 91 | [self.videoProgress setProgress:timeInterval / totalDuration animated:YES]; 92 | } 93 | } 94 | 95 | - (NSTimeInterval)availableDuration { 96 | NSArray *loadedTimeRanges = [[self.playerView.player currentItem] loadedTimeRanges]; 97 | CMTimeRange timeRange = [loadedTimeRanges.firstObject CMTimeRangeValue];// 获取缓冲区域 98 | float startSeconds = CMTimeGetSeconds(timeRange.start); 99 | float durationSeconds = CMTimeGetSeconds(timeRange.duration); 100 | NSTimeInterval result = startSeconds + durationSeconds;// 计算缓冲总进度 101 | return result; 102 | } 103 | 104 | - (void)customVideoSlider:(CMTime)duration { 105 | self.videoSlider.maximumValue = CMTimeGetSeconds(duration); 106 | UIGraphicsBeginImageContextWithOptions((CGSize){ 1, 1 }, NO, 0.0f); 107 | UIImage *transparentImage = UIGraphicsGetImageFromCurrentImageContext(); 108 | UIGraphicsEndImageContext(); 109 | 110 | [self.videoSlider setMinimumTrackImage:transparentImage forState:UIControlStateNormal]; 111 | [self.videoSlider setMaximumTrackImage:transparentImage forState:UIControlStateNormal]; 112 | } 113 | 114 | - (IBAction)stateButtonTouched:(id)sender { 115 | if (!_played) { 116 | [self.playerView.player play]; 117 | [self.stateButton setTitle:@"Stop" forState:UIControlStateNormal]; 118 | } else { 119 | [self.playerView.player pause]; 120 | [self.stateButton setTitle:@"Play" forState:UIControlStateNormal]; 121 | } 122 | _played = !_played; 123 | } 124 | 125 | - (IBAction)videoSlierChangeValue:(id)sender { 126 | UISlider *slider = (UISlider *)sender; 127 | NSLog(@"value change:%f",slider.value); 128 | 129 | if (slider.value == 0.000000) { 130 | __weak typeof(self) weakSelf = self; 131 | [self.playerView.player seekToTime:kCMTimeZero completionHandler:^(BOOL finished) { 132 | [weakSelf.playerView.player play]; 133 | }]; 134 | } 135 | } 136 | 137 | - (IBAction)videoSlierChangeValueEnd:(id)sender { 138 | UISlider *slider = (UISlider *)sender; 139 | NSLog(@"value end:%f",slider.value); 140 | CMTime changedTime = CMTimeMakeWithSeconds(slider.value, 1); 141 | 142 | __weak typeof(self) weakSelf = self; 143 | [self.playerView.player seekToTime:changedTime completionHandler:^(BOOL finished) { 144 | [weakSelf.playerView.player play]; 145 | [weakSelf.stateButton setTitle:@"Stop" forState:UIControlStateNormal]; 146 | }]; 147 | } 148 | 149 | - (void)updateVideoSlider:(CGFloat)currentSecond { 150 | [self.videoSlider setValue:currentSecond animated:YES]; 151 | } 152 | 153 | 154 | - (void)moviePlayDidEnd:(NSNotification *)notification { 155 | NSLog(@"Play end"); 156 | 157 | __weak typeof(self) weakSelf = self; 158 | [self.playerView.player seekToTime:kCMTimeZero completionHandler:^(BOOL finished) { 159 | [weakSelf.videoSlider setValue:0.0 animated:YES]; 160 | [weakSelf.stateButton setTitle:@"Play" forState:UIControlStateNormal]; 161 | }]; 162 | } 163 | 164 | - (NSString *)convertTime:(CGFloat)second{ 165 | NSDate *d = [NSDate dateWithTimeIntervalSince1970:second]; 166 | if (second/3600 >= 1) { 167 | [[self dateFormatter] setDateFormat:@"HH:mm:ss"]; 168 | } else { 169 | [[self dateFormatter] setDateFormat:@"mm:ss"]; 170 | } 171 | NSString *showtimeNew = [[self dateFormatter] stringFromDate:d]; 172 | return showtimeNew; 173 | } 174 | 175 | - (NSDateFormatter *)dateFormatter { 176 | if (!_dateFormatter) { 177 | _dateFormatter = [[NSDateFormatter alloc] init]; 178 | } 179 | return _dateFormatter; 180 | } 181 | 182 | - (void)dealloc { 183 | [self.playerItem removeObserver:self forKeyPath:@"status" context:nil]; 184 | [self.playerItem removeObserver:self forKeyPath:@"loadedTimeRanges" context:nil]; 185 | [[NSNotificationCenter defaultCenter] removeObserver:self name:AVPlayerItemDidPlayToEndTimeNotification object:self.playerItem]; 186 | [self.playerView.player removeTimeObserver:self.playbackTimeObserver]; 187 | } 188 | 189 | - (void)didReceiveMemoryWarning 190 | { 191 | [super didReceiveMemoryWarning]; 192 | // Dispose of any resources that can be recreated. 193 | } 194 | 195 | @end 196 | -------------------------------------------------------------------------------- /AVPlayerDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CD41BF5219177EE0009C283A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD41BF5119177EE0009C283A /* Foundation.framework */; }; 11 | CD41BF5419177EE0009C283A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD41BF5319177EE0009C283A /* CoreGraphics.framework */; }; 12 | CD41BF5619177EE0009C283A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD41BF5519177EE0009C283A /* UIKit.framework */; }; 13 | CD41BF5C19177EE0009C283A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CD41BF5A19177EE0009C283A /* InfoPlist.strings */; }; 14 | CD41BF5E19177EE0009C283A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CD41BF5D19177EE0009C283A /* main.m */; }; 15 | CD41BF6219177EE0009C283A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CD41BF6119177EE0009C283A /* AppDelegate.m */; }; 16 | CD41BF6519177EE0009C283A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CD41BF6319177EE0009C283A /* Main.storyboard */; }; 17 | CD41BF6819177EE0009C283A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CD41BF6719177EE0009C283A /* ViewController.m */; }; 18 | CD41BF6A19177EE0009C283A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CD41BF6919177EE0009C283A /* Images.xcassets */; }; 19 | CD41BF7119177EE0009C283A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD41BF7019177EE0009C283A /* XCTest.framework */; }; 20 | CD41BF7219177EE0009C283A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD41BF5119177EE0009C283A /* Foundation.framework */; }; 21 | CD41BF7319177EE0009C283A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD41BF5519177EE0009C283A /* UIKit.framework */; }; 22 | CD41BF7B19177EE0009C283A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CD41BF7919177EE0009C283A /* InfoPlist.strings */; }; 23 | CD41BF7D19177EE0009C283A /* AVPlayerDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CD41BF7C19177EE0009C283A /* AVPlayerDemoTests.m */; }; 24 | CD41BF88191780FC009C283A /* PlayerView.m in Sources */ = {isa = PBXBuildFile; fileRef = CD41BF87191780FC009C283A /* PlayerView.m */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | CD41BF7419177EE0009C283A /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = CD41BF4619177EE0009C283A /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = CD41BF4D19177EE0009C283A; 33 | remoteInfo = AVPlayerDemo; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | CD41BF4E19177EE0009C283A /* AVPlayerDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AVPlayerDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | CD41BF5119177EE0009C283A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 40 | CD41BF5319177EE0009C283A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 41 | CD41BF5519177EE0009C283A /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 42 | CD41BF5919177EE0009C283A /* AVPlayerDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AVPlayerDemo-Info.plist"; sourceTree = ""; }; 43 | CD41BF5B19177EE0009C283A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 44 | CD41BF5D19177EE0009C283A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 45 | CD41BF5F19177EE0009C283A /* AVPlayerDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AVPlayerDemo-Prefix.pch"; sourceTree = ""; }; 46 | CD41BF6019177EE0009C283A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 47 | CD41BF6119177EE0009C283A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 48 | CD41BF6419177EE0009C283A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 49 | CD41BF6619177EE0009C283A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 50 | CD41BF6719177EE0009C283A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 51 | CD41BF6919177EE0009C283A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 52 | CD41BF6F19177EE0009C283A /* AVPlayerDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AVPlayerDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | CD41BF7019177EE0009C283A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 54 | CD41BF7819177EE0009C283A /* AVPlayerDemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AVPlayerDemoTests-Info.plist"; sourceTree = ""; }; 55 | CD41BF7A19177EE0009C283A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 56 | CD41BF7C19177EE0009C283A /* AVPlayerDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AVPlayerDemoTests.m; sourceTree = ""; }; 57 | CD41BF86191780FC009C283A /* PlayerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlayerView.h; sourceTree = ""; }; 58 | CD41BF87191780FC009C283A /* PlayerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PlayerView.m; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | CD41BF4B19177EE0009C283A /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | CD41BF5419177EE0009C283A /* CoreGraphics.framework in Frameworks */, 67 | CD41BF5619177EE0009C283A /* UIKit.framework in Frameworks */, 68 | CD41BF5219177EE0009C283A /* Foundation.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | CD41BF6C19177EE0009C283A /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | CD41BF7119177EE0009C283A /* XCTest.framework in Frameworks */, 77 | CD41BF7319177EE0009C283A /* UIKit.framework in Frameworks */, 78 | CD41BF7219177EE0009C283A /* Foundation.framework in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | CD41BF4519177EE0009C283A = { 86 | isa = PBXGroup; 87 | children = ( 88 | CD41BF5719177EE0009C283A /* AVPlayerDemo */, 89 | CD41BF7619177EE0009C283A /* AVPlayerDemoTests */, 90 | CD41BF5019177EE0009C283A /* Frameworks */, 91 | CD41BF4F19177EE0009C283A /* Products */, 92 | ); 93 | sourceTree = ""; 94 | }; 95 | CD41BF4F19177EE0009C283A /* Products */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | CD41BF4E19177EE0009C283A /* AVPlayerDemo.app */, 99 | CD41BF6F19177EE0009C283A /* AVPlayerDemoTests.xctest */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | CD41BF5019177EE0009C283A /* Frameworks */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | CD41BF5119177EE0009C283A /* Foundation.framework */, 108 | CD41BF5319177EE0009C283A /* CoreGraphics.framework */, 109 | CD41BF5519177EE0009C283A /* UIKit.framework */, 110 | CD41BF7019177EE0009C283A /* XCTest.framework */, 111 | ); 112 | name = Frameworks; 113 | sourceTree = ""; 114 | }; 115 | CD41BF5719177EE0009C283A /* AVPlayerDemo */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | CD41BF6019177EE0009C283A /* AppDelegate.h */, 119 | CD41BF6119177EE0009C283A /* AppDelegate.m */, 120 | CD41BF6319177EE0009C283A /* Main.storyboard */, 121 | CD41BF6619177EE0009C283A /* ViewController.h */, 122 | CD41BF6719177EE0009C283A /* ViewController.m */, 123 | CD41BF86191780FC009C283A /* PlayerView.h */, 124 | CD41BF87191780FC009C283A /* PlayerView.m */, 125 | CD41BF6919177EE0009C283A /* Images.xcassets */, 126 | CD41BF5819177EE0009C283A /* Supporting Files */, 127 | ); 128 | path = AVPlayerDemo; 129 | sourceTree = ""; 130 | }; 131 | CD41BF5819177EE0009C283A /* Supporting Files */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | CD41BF5919177EE0009C283A /* AVPlayerDemo-Info.plist */, 135 | CD41BF5A19177EE0009C283A /* InfoPlist.strings */, 136 | CD41BF5D19177EE0009C283A /* main.m */, 137 | CD41BF5F19177EE0009C283A /* AVPlayerDemo-Prefix.pch */, 138 | ); 139 | name = "Supporting Files"; 140 | sourceTree = ""; 141 | }; 142 | CD41BF7619177EE0009C283A /* AVPlayerDemoTests */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | CD41BF7C19177EE0009C283A /* AVPlayerDemoTests.m */, 146 | CD41BF7719177EE0009C283A /* Supporting Files */, 147 | ); 148 | path = AVPlayerDemoTests; 149 | sourceTree = ""; 150 | }; 151 | CD41BF7719177EE0009C283A /* Supporting Files */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | CD41BF7819177EE0009C283A /* AVPlayerDemoTests-Info.plist */, 155 | CD41BF7919177EE0009C283A /* InfoPlist.strings */, 156 | ); 157 | name = "Supporting Files"; 158 | sourceTree = ""; 159 | }; 160 | /* End PBXGroup section */ 161 | 162 | /* Begin PBXNativeTarget section */ 163 | CD41BF4D19177EE0009C283A /* AVPlayerDemo */ = { 164 | isa = PBXNativeTarget; 165 | buildConfigurationList = CD41BF8019177EE0009C283A /* Build configuration list for PBXNativeTarget "AVPlayerDemo" */; 166 | buildPhases = ( 167 | CD41BF4A19177EE0009C283A /* Sources */, 168 | CD41BF4B19177EE0009C283A /* Frameworks */, 169 | CD41BF4C19177EE0009C283A /* Resources */, 170 | ); 171 | buildRules = ( 172 | ); 173 | dependencies = ( 174 | ); 175 | name = AVPlayerDemo; 176 | productName = AVPlayerDemo; 177 | productReference = CD41BF4E19177EE0009C283A /* AVPlayerDemo.app */; 178 | productType = "com.apple.product-type.application"; 179 | }; 180 | CD41BF6E19177EE0009C283A /* AVPlayerDemoTests */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = CD41BF8319177EE0009C283A /* Build configuration list for PBXNativeTarget "AVPlayerDemoTests" */; 183 | buildPhases = ( 184 | CD41BF6B19177EE0009C283A /* Sources */, 185 | CD41BF6C19177EE0009C283A /* Frameworks */, 186 | CD41BF6D19177EE0009C283A /* Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | CD41BF7519177EE0009C283A /* PBXTargetDependency */, 192 | ); 193 | name = AVPlayerDemoTests; 194 | productName = AVPlayerDemoTests; 195 | productReference = CD41BF6F19177EE0009C283A /* AVPlayerDemoTests.xctest */; 196 | productType = "com.apple.product-type.bundle.unit-test"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | CD41BF4619177EE0009C283A /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastUpgradeCheck = 0510; 205 | ORGANIZATIONNAME = yiban; 206 | TargetAttributes = { 207 | CD41BF4D19177EE0009C283A = { 208 | SystemCapabilities = { 209 | com.apple.BackgroundModes = { 210 | enabled = 0; 211 | }; 212 | }; 213 | }; 214 | CD41BF6E19177EE0009C283A = { 215 | TestTargetID = CD41BF4D19177EE0009C283A; 216 | }; 217 | }; 218 | }; 219 | buildConfigurationList = CD41BF4919177EE0009C283A /* Build configuration list for PBXProject "AVPlayerDemo" */; 220 | compatibilityVersion = "Xcode 3.2"; 221 | developmentRegion = English; 222 | hasScannedForEncodings = 0; 223 | knownRegions = ( 224 | en, 225 | Base, 226 | ); 227 | mainGroup = CD41BF4519177EE0009C283A; 228 | productRefGroup = CD41BF4F19177EE0009C283A /* Products */; 229 | projectDirPath = ""; 230 | projectRoot = ""; 231 | targets = ( 232 | CD41BF4D19177EE0009C283A /* AVPlayerDemo */, 233 | CD41BF6E19177EE0009C283A /* AVPlayerDemoTests */, 234 | ); 235 | }; 236 | /* End PBXProject section */ 237 | 238 | /* Begin PBXResourcesBuildPhase section */ 239 | CD41BF4C19177EE0009C283A /* Resources */ = { 240 | isa = PBXResourcesBuildPhase; 241 | buildActionMask = 2147483647; 242 | files = ( 243 | CD41BF6A19177EE0009C283A /* Images.xcassets in Resources */, 244 | CD41BF5C19177EE0009C283A /* InfoPlist.strings in Resources */, 245 | CD41BF6519177EE0009C283A /* Main.storyboard in Resources */, 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | }; 249 | CD41BF6D19177EE0009C283A /* Resources */ = { 250 | isa = PBXResourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | CD41BF7B19177EE0009C283A /* InfoPlist.strings in Resources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | /* End PBXResourcesBuildPhase section */ 258 | 259 | /* Begin PBXSourcesBuildPhase section */ 260 | CD41BF4A19177EE0009C283A /* Sources */ = { 261 | isa = PBXSourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | CD41BF6819177EE0009C283A /* ViewController.m in Sources */, 265 | CD41BF6219177EE0009C283A /* AppDelegate.m in Sources */, 266 | CD41BF5E19177EE0009C283A /* main.m in Sources */, 267 | CD41BF88191780FC009C283A /* PlayerView.m in Sources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | CD41BF6B19177EE0009C283A /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | CD41BF7D19177EE0009C283A /* AVPlayerDemoTests.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXTargetDependency section */ 282 | CD41BF7519177EE0009C283A /* PBXTargetDependency */ = { 283 | isa = PBXTargetDependency; 284 | target = CD41BF4D19177EE0009C283A /* AVPlayerDemo */; 285 | targetProxy = CD41BF7419177EE0009C283A /* PBXContainerItemProxy */; 286 | }; 287 | /* End PBXTargetDependency section */ 288 | 289 | /* Begin PBXVariantGroup section */ 290 | CD41BF5A19177EE0009C283A /* InfoPlist.strings */ = { 291 | isa = PBXVariantGroup; 292 | children = ( 293 | CD41BF5B19177EE0009C283A /* en */, 294 | ); 295 | name = InfoPlist.strings; 296 | sourceTree = ""; 297 | }; 298 | CD41BF6319177EE0009C283A /* Main.storyboard */ = { 299 | isa = PBXVariantGroup; 300 | children = ( 301 | CD41BF6419177EE0009C283A /* Base */, 302 | ); 303 | name = Main.storyboard; 304 | sourceTree = ""; 305 | }; 306 | CD41BF7919177EE0009C283A /* InfoPlist.strings */ = { 307 | isa = PBXVariantGroup; 308 | children = ( 309 | CD41BF7A19177EE0009C283A /* en */, 310 | ); 311 | name = InfoPlist.strings; 312 | sourceTree = ""; 313 | }; 314 | /* End PBXVariantGroup section */ 315 | 316 | /* Begin XCBuildConfiguration section */ 317 | CD41BF7E19177EE0009C283A /* Debug */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ALWAYS_SEARCH_USER_PATHS = NO; 321 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BOOL_CONVERSION = YES; 326 | CLANG_WARN_CONSTANT_CONVERSION = YES; 327 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 328 | CLANG_WARN_EMPTY_BODY = YES; 329 | CLANG_WARN_ENUM_CONVERSION = YES; 330 | CLANG_WARN_INT_CONVERSION = YES; 331 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_DYNAMIC_NO_PIC = NO; 337 | GCC_OPTIMIZATION_LEVEL = 0; 338 | GCC_PREPROCESSOR_DEFINITIONS = ( 339 | "DEBUG=1", 340 | "$(inherited)", 341 | ); 342 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 343 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 344 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 345 | GCC_WARN_UNDECLARED_SELECTOR = YES; 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 347 | GCC_WARN_UNUSED_FUNCTION = YES; 348 | GCC_WARN_UNUSED_VARIABLE = YES; 349 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 350 | ONLY_ACTIVE_ARCH = YES; 351 | SDKROOT = iphoneos; 352 | TARGETED_DEVICE_FAMILY = 2; 353 | }; 354 | name = Debug; 355 | }; 356 | CD41BF7F19177EE0009C283A /* Release */ = { 357 | isa = XCBuildConfiguration; 358 | buildSettings = { 359 | ALWAYS_SEARCH_USER_PATHS = NO; 360 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 361 | CLANG_CXX_LIBRARY = "libc++"; 362 | CLANG_ENABLE_MODULES = YES; 363 | CLANG_ENABLE_OBJC_ARC = YES; 364 | CLANG_WARN_BOOL_CONVERSION = YES; 365 | CLANG_WARN_CONSTANT_CONVERSION = YES; 366 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 367 | CLANG_WARN_EMPTY_BODY = YES; 368 | CLANG_WARN_ENUM_CONVERSION = YES; 369 | CLANG_WARN_INT_CONVERSION = YES; 370 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 371 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 372 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 373 | COPY_PHASE_STRIP = YES; 374 | ENABLE_NS_ASSERTIONS = NO; 375 | GCC_C_LANGUAGE_STANDARD = gnu99; 376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 378 | GCC_WARN_UNDECLARED_SELECTOR = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 380 | GCC_WARN_UNUSED_FUNCTION = YES; 381 | GCC_WARN_UNUSED_VARIABLE = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 383 | SDKROOT = iphoneos; 384 | TARGETED_DEVICE_FAMILY = 2; 385 | VALIDATE_PRODUCT = YES; 386 | }; 387 | name = Release; 388 | }; 389 | CD41BF8119177EE0009C283A /* Debug */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 393 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 394 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 395 | GCC_PREFIX_HEADER = "AVPlayerDemo/AVPlayerDemo-Prefix.pch"; 396 | INFOPLIST_FILE = "AVPlayerDemo/AVPlayerDemo-Info.plist"; 397 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | WRAPPER_EXTENSION = app; 400 | }; 401 | name = Debug; 402 | }; 403 | CD41BF8219177EE0009C283A /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 407 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 408 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 409 | GCC_PREFIX_HEADER = "AVPlayerDemo/AVPlayerDemo-Prefix.pch"; 410 | INFOPLIST_FILE = "AVPlayerDemo/AVPlayerDemo-Info.plist"; 411 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | WRAPPER_EXTENSION = app; 414 | }; 415 | name = Release; 416 | }; 417 | CD41BF8419177EE0009C283A /* Debug */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AVPlayerDemo.app/AVPlayerDemo"; 421 | FRAMEWORK_SEARCH_PATHS = ( 422 | "$(SDKROOT)/Developer/Library/Frameworks", 423 | "$(inherited)", 424 | "$(DEVELOPER_FRAMEWORKS_DIR)", 425 | ); 426 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 427 | GCC_PREFIX_HEADER = "AVPlayerDemo/AVPlayerDemo-Prefix.pch"; 428 | GCC_PREPROCESSOR_DEFINITIONS = ( 429 | "DEBUG=1", 430 | "$(inherited)", 431 | ); 432 | INFOPLIST_FILE = "AVPlayerDemoTests/AVPlayerDemoTests-Info.plist"; 433 | PRODUCT_NAME = "$(TARGET_NAME)"; 434 | TEST_HOST = "$(BUNDLE_LOADER)"; 435 | WRAPPER_EXTENSION = xctest; 436 | }; 437 | name = Debug; 438 | }; 439 | CD41BF8519177EE0009C283A /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/AVPlayerDemo.app/AVPlayerDemo"; 443 | FRAMEWORK_SEARCH_PATHS = ( 444 | "$(SDKROOT)/Developer/Library/Frameworks", 445 | "$(inherited)", 446 | "$(DEVELOPER_FRAMEWORKS_DIR)", 447 | ); 448 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 449 | GCC_PREFIX_HEADER = "AVPlayerDemo/AVPlayerDemo-Prefix.pch"; 450 | INFOPLIST_FILE = "AVPlayerDemoTests/AVPlayerDemoTests-Info.plist"; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | TEST_HOST = "$(BUNDLE_LOADER)"; 453 | WRAPPER_EXTENSION = xctest; 454 | }; 455 | name = Release; 456 | }; 457 | /* End XCBuildConfiguration section */ 458 | 459 | /* Begin XCConfigurationList section */ 460 | CD41BF4919177EE0009C283A /* Build configuration list for PBXProject "AVPlayerDemo" */ = { 461 | isa = XCConfigurationList; 462 | buildConfigurations = ( 463 | CD41BF7E19177EE0009C283A /* Debug */, 464 | CD41BF7F19177EE0009C283A /* Release */, 465 | ); 466 | defaultConfigurationIsVisible = 0; 467 | defaultConfigurationName = Release; 468 | }; 469 | CD41BF8019177EE0009C283A /* Build configuration list for PBXNativeTarget "AVPlayerDemo" */ = { 470 | isa = XCConfigurationList; 471 | buildConfigurations = ( 472 | CD41BF8119177EE0009C283A /* Debug */, 473 | CD41BF8219177EE0009C283A /* Release */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | CD41BF8319177EE0009C283A /* Build configuration list for PBXNativeTarget "AVPlayerDemoTests" */ = { 479 | isa = XCConfigurationList; 480 | buildConfigurations = ( 481 | CD41BF8419177EE0009C283A /* Debug */, 482 | CD41BF8519177EE0009C283A /* Release */, 483 | ); 484 | defaultConfigurationIsVisible = 0; 485 | defaultConfigurationName = Release; 486 | }; 487 | /* End XCConfigurationList section */ 488 | }; 489 | rootObject = CD41BF4619177EE0009C283A /* Project object */; 490 | } 491 | --------------------------------------------------------------------------------