视频播放 MPMoViewPlayerController

来源:互联网 发布:淘宝好的买女鞋的店铺 编辑:程序博客网 时间:2024/06/06 00:34
- (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];}
有问题,以后在查资料学习。
原创粉丝点击