【发布时间】:2015-07-28 03:31:49
【问题描述】:
当我打开视图时,我正试图让视频单独启动,但是它的声音可以正常工作。视图是空白的。我正在使用 MPMoviePlayerController 来执行此操作。
我的代码是这样的:
@property (nonatomic, strong) MPMoviePlayerController *moviePlayer;
- (void)viewDidLoad {
[super viewDidLoad];
[self playVideo];
}
-(void)playVideo {
NSString *videoFile = [[NSBundle mainBundle] pathForResource:@"fds" ofType:@"mp4"];
self.moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:[NSURL fileURLWithPath:videoFile]];
[self.playerView addSubview:self.moviePlayer.view];
self.moviePlayer.fullscreen = YES;
self.moviePlayer.allowsAirPlay = YES;
[self.moviePlayer play];
}
【问题讨论】:
标签: objective-c mpmovieplayercontroller ios8.3