码迷,mamicode.com
首页 > 其他好文 > 详细

蓝懿教育 视频播放的三种方式

时间:2015-10-29 16:17:36      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

- (IBAction)bofang:(id)sender {

    NSString *path =@"http://115.231.158.26/video.sinosns.cn/hlj/nzsccdkxlr.mp4";

    NSURL *url =[NSURL URLWithString:path];

    self.movie =[[MPMoviePlayerController alloc]initWithContentURL:url];

    [self.movie.view setFrame:CGRectMake(0, 0, 320, 568)];

    [self.view addSubview:self.movie.view];

    

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(endmovie) name:MPMoviePlayerPlaybackDidFinishNotification object:self.movie];

    [self.movie play];

}

 

- (IBAction)two:(id)sender {

    NSString *path =@"http://115.231.158.26/video.sinosns.cn/hlj/nzsccdkxlr.mp4";

    NSURL *url =[NSURL URLWithString:path];

    MPMoviePlayerViewController *movie =[[MPMoviePlayerViewController alloc]initWithContentURL:url];

    [movie.moviePlayer prepareToPlay];

    [self presentMoviePlayerViewControllerAnimated:movie];

}

- (IBAction)three:(id)sender {

    NSString *path =@"http://115.231.158.26/video.sinosns.cn/hlj/nzsccdkxlr.mp4";

    NSURL *url =[NSURL URLWithString:path];

    MXLMediaView *mediaView =[[MXLMediaView alloc]init];

    [mediaView setDelegate:self];

//    [mediaView showVideoWithURL:url inParentView:self.view completion:^{

//        NSLog(@"Complete");

//    }];

    [mediaView showVideoWithURL:url inParentView:self.view completion:nil];

    NSLog(@"播放视频");

}

 

-(void)endmovie{

    

    [self.movie stop];

    [self.movie.view removeFromSuperview];

    

}

蓝懿教育 视频播放的三种方式

标签:

原文地址:http://www.cnblogs.com/stuyingiOS/p/4920647.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!