您的位置:首页 > 其它

AVPlayer简单地视频播放器

2015-12-03 11:37 197 查看
#import <AVFoundation/AVFoundation.h>
#import <AVKit/AVKit.h>


@property (nonatomic, retain) AVPlayerViewController *moviePlayer;  //播放器


@property(nonatomic,assign)BOOL isPlay;


//初始化
self.moviePlayer = [[AVPlayerViewController alloc]init];
//设置视频尺寸
self.moviePlayer.view.frame = CGRectMake(0, 0, 375, 667);
[self.view addSubview:self.moviePlayer.view];
self.moviePlayer.player = [AVPlayer playerWithURL:[NSURL URLWithString:self.playUrl]];
[_moviePlayer release];


//横屏

-
(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{

return UIInterfaceOrientationLandscapeRight;

}


不写横屏方法的情况下:



写横屏方法的情况下:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: