我做了一個示例演示 使用AVPlayer在我的模擬器上播放視頻。 但我的問題是視頻不顯示該視頻的音頻在哪裏工作。視頻不顯示我使用AVPlayer只有音頻工作
代碼是:
@property (nonatomic,strong)AVPlayerViewController *videoPlayer;
-(IBAction)playVideo:(id)sender {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"video" ofType:@"mp4"]];
AVPlayer *player = [AVPlayer playerWithURL:url];
self.videoPlayer = [[AVPlayerViewController alloc]init];
[self presentViewController:self.videoPlayer animated:YES completion:nil];
self.videoPlayer.player = player;
self.videoPlayer.showsPlaybackControls=YES;
self.videoPlayer.view.frame = self.view.frame;
[self.view addSubview:self.videoPlayer.view];
[player play];
}
[自presentViewController:self.videoPlayer動畫:是完成:零]刪除此行 – Birendra
self.videoPlayer.view.frame = self.view.bounds。並將此代碼應用於播放器fram – Birendra