視頻播放 MPMoViewPlayerController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        //監聽視頻播放的狀態
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playDidChangeNotification:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:nil];
    }
    return self;
}

- (void)playDidChangeNotification:(NSNotification *)notification
{
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    //NSString *path = [[NSBundle mainBundle] pathForResource:@"千鋒3G學院-iOS開發視頻教程-憤怒的小鳥-第01講-Cocos2D介紹" ofType:@"mp4"];
//    NSURL *url = [NSURL URLWithString:@"http://222.187.223.21/cdn.baidupcs.com/file/d4432bc0bba91107844a7288fc547e89?xcode=660c41db1ab4267db8b32216815cd7bbb9b238f716855333&fid=1695602658-250528-761577522&time=1385599573&sign=FDTAXER-DCb740ccc5511e5e8fedcff06b081203-tUnw%2F3WDcT8ULY1EydIf3PlEMEQ%3D&to=cb&fm=Q,B,T,t&expires=8h&rt=pr&r=994769278&logid=3556671976&vuk=1695602658&wshc_tag=0&wsiphost=ipdbm"];
//    MPMoviePlayerController *movicePlayer = [[MPMoviePlayerController alloc]initWithContentURL:url];
//    movicePlayer.view.frame = CGRectMake(0, 0, 320, 320);
//    [self.view addSubview:movicePlayer.view];
//    [movicePlayer play];
    
    NSURL *url = [NSURL URLWithString:@""];
    MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc]initWithContentURL:url];
    [self presentModalViewController:moviePlayer animated:YES];
    [moviePlayer release];
    
    self.view.backgroundColor = [UIColor grayColor];
}
有問題,以後在查資料學習。
發佈了65 篇原創文章 · 獲贊 7 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章