#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;
}
不写横屏方法的情况下:
写横屏方法的情况下: