在ios9 以前,如果调用视频播放,我们只需要添加
<MediaPlayer/MediaPlayer.h>这个框架,并用下面方法即可
MPMoviePlayerViewController *playerVc = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
,可是在ios9系统中以后,他会报以下警告
意思是说
MPMoviePlayerViewController 这个类在ios9当中是过时的,苹果推荐使用<a href="http://www.baicaigo.cc/">
</a>AVPlayerViewController
AVPlayerViewController *avPlayerVC = [[AVPlayerViewController alloc] init]; AVPlayer *play = [AVPlayer playerWithURL:url]; avPlayerVC.player = play;
只需要倒入<AVFoundation/AVFoundation.h> <AVKit/AVKit.h> 两个框架即可